Reverse target architecture mapping logic #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release-nightly-verify-binary-architecture | |
on: | |
workflow_dispatch: | |
push: | |
env: | |
CARGO_TERM_COLOR: always | |
RUSTFLAGS: "-D warnings" | |
jobs: | |
nightly-last-run: | |
runs-on: ubuntu-latest | |
name: Check latest commit | |
outputs: | |
should_run: ${{ steps.should_run.outputs.should_run }} | |
# if: ${{ github.repository_owner == 'gleam-lang' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: print latest_commit | |
run: echo ${{ github.sha }} | |
- id: should_run | |
continue-on-error: true | |
name: check latest commit is less than a day | |
if: ${{ github.event_name == 'schedule' }} | |
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "should_run=false" >> $GITHUB_OUTPUT | |
build-nightly-clean: | |
runs-on: ubuntu-latest | |
needs: [ nightly-last-run ] | |
# if: ${{ github.repository_owner == 'gleam-lang' && needs.nightly-last-run.outputs.should_run != 'false' }} | |
steps: | |
- name: Delete old release assets | |
uses: mknejp/delete-release-assets@v1 | |
with: | |
token: ${{ github.token }} | |
tag: nightly | |
fail-if-no-assets: false | |
fail-if-no-release: false | |
assets: | | |
*.zip | |
*.tar.gz | |
*.sha256 | |
*.sha512 | |
build-nightly: | |
name: build-release | |
runs-on: ${{ matrix.os }} | |
needs: [ build-nightly-clean ] | |
# if: ${{ github.repository_owner == 'gleam-lang' }} | |
strategy: | |
matrix: | |
target: | |
- x86_64-unknown-linux-gnu | |
- aarch64-unknown-linux-gnu | |
- x86_64-unknown-linux-musl | |
- aarch64-unknown-linux-musl | |
- x86_64-apple-darwin | |
- aarch64-apple-darwin | |
- x86_64-pc-windows-msvc | |
- aarch64-pc-windows-msvc | |
toolchain: [stable] | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
use-cross: false | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
use-cross: true | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
use-cross: true | |
- os: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
use-cross: true | |
# macos>=14 runs exclusively on aarch64 and will thus fail to execute properly for x64 | |
- os: macos-13 | |
target: x86_64-apple-darwin | |
use-cross: false | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
use-cross: false | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
use-cross: false | |
- os: windows-latest | |
target: aarch64-pc-windows-msvc | |
use-cross: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Update versions | |
shell: bash | |
run: | | |
./bin/add-nightly-suffix-to-versions.sh | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.toolchain }} | |
target: ${{ matrix.target }} | |
- name: Handle Rust dependencies caching | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: v1-${{ matrix.target }} | |
- name: Build release binary | |
uses: clechasseur/rs-cargo@v2 | |
with: | |
command: build | |
args: --release --target ${{ matrix.target }} | |
use-cross: ${{ matrix.use-cross }} | |
- name: Verify binary architecture | |
shell: bash | |
run: | | |
set -xeuo pipefail | |
BINARY_PATH="target/${{ matrix.target }}/release/gleam" | |
if [[ "${{ matrix.target }}" == *"windows"* ]]; then | |
BINARY_PATH="${BINARY_PATH}.exe" | |
fi | |
./bin/verify-binary-architecture.sh "${{ matrix.target }}" "$BINARY_PATH" |