Merge branch 'gleam-lang:main' into main #9
Workflow file for this run
This file contains hidden or 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 | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUSTFLAGS: "-D warnings" | |
| jobs: | |
| build-release: | |
| name: build-release | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| target: | |
| - aarch64-unknown-linux-musl | |
| - armv7-unknown-linux-gnueabihf | |
| toolchain: [stable] | |
| include: | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| binary: aarch64 | |
| cargo-tool: cross | |
| - os: ubuntu-latest | |
| target: armv7-unknown-linux-gnueabihf | |
| binary: armhf | |
| cargo-tool: cross | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - 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@v3 | |
| with: | |
| command: build | |
| args: --release --target ${{ matrix.target }} | |
| tool: ${{ matrix.cargo-tool }} | |
| - name: Verify binary architecture | |
| shell: bash | |
| run: | | |
| BINARY_PATH="target/${{ matrix.target }}/release/gleam" | |
| if [[ "${{ matrix.target }}" == *"windows"* ]]; then | |
| BINARY_PATH="${BINARY_PATH}.exe" | |
| fi | |
| if ! file -b "$BINARY_PATH" | grep -q "${{ matrix.binary }}"; then | |
| echo "error: Architecture mismatch" | |
| echo "Expected architecture: '${{ matrix.binary }}'" | |
| echo "Found binary type: '$(file -b "$BINARY_PATH")'" | |
| exit 1 | |
| fi | |
| echo "ok: Architecture match" | |
| - name: Build archive | |
| shell: bash | |
| run: | | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
| ARCHIVE="gleam-$VERSION-${{ matrix.target }}.zip" | |
| cp "target/${{ matrix.target }}/release/gleam.exe" "gleam.exe" | |
| 7z a "$ARCHIVE" "gleam.exe" | |
| rm gleam.exe | |
| else | |
| ARCHIVE="gleam-$VERSION-${{ matrix.target }}.tar.gz" | |
| cp "target/${{ matrix.target }}/release/gleam" "gleam" | |
| tar -czvf "$ARCHIVE" "gleam" | |
| rm gleam | |
| fi | |
| openssl dgst -r -sha256 -out "$ARCHIVE".sha256 "$ARCHIVE" | |
| openssl dgst -r -sha512 -out "$ARCHIVE".sha512 "$ARCHIVE" | |
| echo "ASSET=$ARCHIVE" >> $GITHUB_ENV | |
| - name: Ensure binary successfully boots | |
| shell: bash | |
| run: | | |
| case "${{ matrix.target }}" in | |
| x86_64-pc-windows-msvc) | |
| 7z x "$ASSET" | |
| ./gleam.exe --version ;; | |
| aarch64*) | |
| echo "We cannot test an ARM binary on a AMD64 runner" ;; | |
| armv7*) | |
| echo "We cannot test an ARM binary on a AMD64 runner" ;; | |
| *) | |
| tar -xvzf "$ASSET" | |
| ./gleam --version ;; | |
| esac | |
| - name: Upload release archive | |
| # https://github.com/softprops/action-gh-release/issues/445 | |
| # uses: softprops/action-gh-release@v2 | |
| uses: softprops/action-gh-release@0bd7e8b279c9b5b36661d552472fbbfe671fe26e | |
| with: | |
| draft: true | |
| prerelease: false | |
| fail_on_unmatched_files: true | |
| files: | | |
| ${{ env.ASSET }} | |
| ${{ env.ASSET }}.sha256 | |
| ${{ env.ASSET }}.sha512 | |
| build-release-wasm: | |
| name: build-release-wasm | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: wasm32-unknown-unknown | |
| profile: minimal | |
| override: true | |
| - name: Install wasm-pack | |
| run: curl -sSL https://rustwasm.github.io/wasm-pack/installer/init.sh | sh | |
| - name: Build wasm | |
| run: wasm-pack build --release --target web compiler-wasm | |
| - name: Build wasm archive | |
| run: | | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| ARCHIVE="gleam-$VERSION-browser.tar.gz" | |
| tar -C compiler-wasm/pkg/ -czvf $ARCHIVE . | |
| openssl dgst -r -sha256 -out "$ARCHIVE".sha256 "$ARCHIVE" | |
| openssl dgst -r -sha512 -out "$ARCHIVE".sha512 "$ARCHIVE" | |
| echo "ASSET=$ARCHIVE" >> $GITHUB_ENV | |
| - name: Upload release archive | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| prerelease: false | |
| fail_on_unmatched_files: true | |
| files: | | |
| ${{ env.ASSET }} | |
| ${{ env.ASSET }}.sha256 | |
| ${{ env.ASSET }}.sha512 |