Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
908e8d7
Build on all supported platforms in standard CI run
adamtroiani May 15, 2025
68e1488
build is done in parallel with other jobs
adamtroiani May 15, 2025
5aad225
fixed formatting, removed unneeded fields from matrix variables
adamtroiani May 16, 2025
b366d8d
test publish workflow
adamtroiani May 16, 2025
de995c2
Consolidated building and publishing into one workflow
adamtroiani May 16, 2025
b16f580
reverted to old design with should_publish variable introduced
adamtroiani May 16, 2025
d90adcd
removed instances of github.event.release.tag_name from build-and-pub…
adamtroiani May 16, 2025
c93df26
removed comments - ready for pr
adamtroiani May 16, 2025
e049638
removed workflow dispatch from default ci triggers
adamtroiani May 20, 2025
70c2edf
refactored workflows: build and publish happen in separate jobs
adamtroiani May 22, 2025
488ac5a
commented out lines for testing
adamtroiani May 22, 2025
9ce8564
recursively search artifacts directory instead of looking for files i…
adamtroiani May 22, 2025
5cba887
simplifying artifact directory structure
adamtroiani May 22, 2025
7276669
simplified artifact path
adamtroiani May 22, 2025
ef4dbbb
reverted back to old asset paths
adamtroiani May 23, 2025
92d1d8a
fixed asset name
adamtroiani May 23, 2025
ce15501
removed debug statements and uncommented lines
adamtroiani May 23, 2025
293a80a
use github output variables instead of searching for assets
adamtroiani May 23, 2025
4f51182
test
adamtroiani May 23, 2025
29c1eac
simplified artifact release uploads
adamtroiani May 23, 2025
6dac12a
added should_upload_artifacts boolean to build workflow
adamtroiani Jun 2, 2025
efc2d1b
added conditional to all build steps that are only used in publish wo…
adamtroiani Jun 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Build

on:
workflow_call:
inputs:
tag_name:
description: "Tag name"
required: true
type: string
should_upload_artifacts:
description: "Should upload artifacts"
required: false
type: boolean
default: false

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: x86_64-unknown-linux-gnu
os: ubuntu-22.04
path: target/x86_64-unknown-linux-gnu/release/function-runner
asset_name: function-runner-x86_64-linux-${{ inputs.tag_name }}
shasum_cmd: sha256sum
- name: aarch64-unknown-linux-gnu
os: ubuntu-22.04
path: target/aarch64-unknown-linux-gnu/release/function-runner
asset_name: function-runner-arm-linux-${{ inputs.tag_name }}
shasum_cmd: sha256sum
- name: x86_64-apple-darwin
os: macos-latest
path: target/x86_64-apple-darwin/release/function-runner
asset_name: function-runner-x86_64-macos-${{ inputs.tag_name }}
shasum_cmd: shasum -a 256
- name: aarch64-apple-darwin
os: macos-latest
path: target/aarch64-apple-darwin/release/function-runner
asset_name: function-runner-arm-macos-${{ inputs.tag_name }}
shasum_cmd: shasum -a 256
- name: x86_64-pc-windows-msvc
os: windows-latest
path: target\x86_64-pc-windows-msvc\release\function-runner.exe
asset_name: function-runner-x86_64-windows-${{ inputs.tag_name }}
shasum_cmd: sha256sum

steps:
- uses: actions/checkout@v4

- name: Install cross compiler
if: ${{ matrix.name == 'aarch64-unknown-linux-gnu' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Set up cross compiler env variables
if: ${{ matrix.name == 'aarch64-unknown-linux-gnu' }}
run: |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV

- name: Install target
run: rustup target add ${{ matrix.name }}

- name: Build ${{ matrix.name }}
run: cargo build --release --target ${{ matrix.name }} --package function-runner

- name: Archive assets
if: ${{ inputs.should_upload_artifacts }}
run: gzip -k -f ${{ matrix.path }} && mv ${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz

- name: Upload assets to artifacts
if: ${{ inputs.should_upload_artifacts }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}.gz
path: ${{ matrix.asset_name }}.gz

- name: Generate asset hash
if: ${{ inputs.should_upload_artifacts }}
run: ${{ matrix.shasum_cmd }} ${{ matrix.asset_name }}.gz | awk '{ print $1 }' > ${{ matrix.asset_name }}.gz.sha256

- name: Upload asset hash to artifacts
if: ${{ inputs.should_upload_artifacts }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}.gz.sha256
path: ${{ matrix.asset_name }}.gz.sha256
99 changes: 18 additions & 81 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,90 +12,27 @@ on:
type: string

jobs:
compile:
name: Compile
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: linux
os: ubuntu-22.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
path: target/x86_64-unknown-linux-gnu/release/function-runner
asset_name: function-runner-x86_64-linux-${{ inputs.tag_name || github.event.release.tag_name }}
shasum_cmd: sha256sum
target: x86_64-unknown-linux-gnu
- name: linux-arm64
os: ubuntu-22.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
path: target/aarch64-unknown-linux-gnu/release/function-runner
asset_name: function-runner-arm-linux-${{ inputs.tag_name || github.event.release.tag_name }}
shasum_cmd: sha256sum
target: aarch64-unknown-linux-gnu
- name: macos
os: macos-latest
path: target/x86_64-apple-darwin/release/function-runner
asset_name: function-runner-x86_64-macos-${{ inputs.tag_name || github.event.release.tag_name }}
shasum_cmd: shasum -a 256
target: x86_64-apple-darwin
- name: arm64-macos
os: macos-latest
path: target/aarch64-apple-darwin/release/function-runner
asset_name: function-runner-arm-macos-${{ inputs.tag_name || github.event.release.tag_name }}
shasum_cmd: shasum -a 256
target: aarch64-apple-darwin
- name: windows
os: windows-latest
path: target\x86_64-pc-windows-msvc\release\function-runner.exe
asset_name: function-runner-x86_64-windows-${{ inputs.tag_name || github.event.release.tag_name }}
shasum_cmd: sha256sum
target: x86_64-pc-windows-msvc

build:
uses: ./.github/workflows/build.yml
with:
tag_name: ${{ inputs.tag_name || github.event.release.tag_name }}
should_upload_artifacts: true

publish:
name: Publish
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install cross compiler
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu

- name: Set up cross compiler env variables
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV

# Should no-op except for macos-arm case where that target won't be installed
- name: Install target
run: rustup target add ${{ matrix.target }}

- name: Build ${{ matrix.target }}
run: cargo build --release --target ${{ matrix.target }} --package function-runner

- name: Archive assets
run: gzip -k -f ${{ matrix.path }} && mv ${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz

- name: Upload assets to artifacts
uses: actions/upload-artifact@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.asset_name }}.gz
path: ${{ matrix.asset_name }}.gz
path: artifacts

- name: Upload assets to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ inputs.tag_name || github.event.release.tag_name }} ${{ matrix.asset_name }}.gz

- name: Generate asset hash
run: ${{ matrix.shasum_cmd }} ${{ matrix.asset_name }}.gz | awk '{ print $1 }' > ${{ matrix.asset_name }}.gz.sha256

- name: Upload asset hash to artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}.gz.sha256
path: ${{ matrix.asset_name }}.gz.sha256

- name: Upload asset hash to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ inputs.tag_name || github.event.release.tag_name }} ${{ matrix.asset_name }}.gz.sha256
run: |
# Upload all files from the build job
for file in artifacts/*; do
gh release upload ${{ inputs.tag_name || github.event.release.tag_name }} $file
done
10 changes: 8 additions & 2 deletions .github/workflows/script-runner.rust.default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Rust

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
check:
Expand Down Expand Up @@ -48,3 +48,9 @@ jobs:
toolchain: stable
components: clippy
- run: cargo clippy -- -D warnings

build:
name: Build
uses: ./.github/workflows/build.yml
with:
tag_name: "ci-build"