diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a809e16..a18302e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -15,6 +15,9 @@ jobs: create-release: name: create-release runs-on: ubuntu-latest + defaults: + run: + shell: bash steps: - uses: actions/checkout@v4 @@ -29,7 +32,6 @@ jobs: run: | echo "version is: $VERSION" - name: Check that tag version and Cargo.toml version are the same - shell: bash run: | VERSION=${VERSION#v} # strip leading v if present only for the Cargo.toml check if ! grep -q "version = \"$VERSION\"" Cargo.toml; then @@ -49,6 +51,9 @@ jobs: name: build-release needs: ['create-release'] runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash env: # For some builds, we use cross to test on 32-bit and big-endian # systems. @@ -71,25 +76,27 @@ jobs: fail-fast: false matrix: include: - - build: stable-x86 + - build: ubuntu-x86 os: ubuntu-latest rust: stable target: x86_64-unknown-linux-gnu - qemu: i386 - - build: stable-aarch64 + cross-platform: x86_64-unknown-linux-musl + - build: ubuntu-aarch64 os: ubuntu-latest rust: stable target: aarch64-unknown-linux-gnu strip: aarch64-linux-gnu-strip - qemu: qemu-aarch64 - # - build: macos - # os: macos-latest - # rust: nightly - # target: x86_64-apple-darwin - # - build: win-msvc - # os: windows-latest - # rust: nightly - # target: x86_64-pc-windows-msvc + cross-platform: x86_64-unknown-linux-musl + - build: macos-x86 + os: macos-latest + rust: stable + target: x86_64-apple-darwin + cross-platform: x86_64-apple-darwin + - build: macos-aarch64 + os: macos-latest + rust: stable + target: aarch64-apple-darwin + cross-platform: x86_64-apple-darwin steps: - name: Checkout repository @@ -97,7 +104,6 @@ jobs: - name: Install packages (Ubuntu) if: matrix.os == 'ubuntu-latest' - shell: bash run: |- sudo apt-get update sudo apt-get install -y openssl ca-certificates pkg-config cmake libssl-dev @@ -109,11 +115,9 @@ jobs: brew install pkg-config - name: Install buf - if: matrix.os == 'ubuntu-latest' uses: bufbuild/buf-setup-action@v1 - name: Install Protoc - if: matrix.os == 'ubuntu-latest' uses: arduino/setup-protoc@v3 - name: Install Rust @@ -124,7 +128,6 @@ jobs: - name: Use Cross if: matrix.os == 'ubuntu-latest' && matrix.target != '' - shell: bash run: | # In the past, new releases of 'cross' have broken CI. So for now, we # pin it. We also use their pre-compiled binary releases because cross @@ -133,25 +136,22 @@ jobs: mkdir "$dir" echo "$dir" >> $GITHUB_PATH cd "$dir" - curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-x86_64-unknown-linux-musl.tar.gz" - tar xf cross-x86_64-unknown-linux-musl.tar.gz + curl -LO "https://github.com/cross-rs/cross/releases/download/$CROSS_VERSION/cross-${{ matrix.cross-platform }}.tar.gz" + tar xf cross-${{ matrix.cross-platform }}.tar.gz echo "CARGO=cross" >> $GITHUB_ENV - name: Set target variables - shell: bash run: | echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV - name: Show command used for Cargo - shell: bash run: | echo "cargo command is: ${{ env.CARGO }}" echo "target flag is: ${{ env.TARGET_FLAGS }}" echo "target dir is: ${{ env.TARGET_DIR }}" - name: Build release binary - shell: bash run: | ${{ env.CARGO }} build --bin gvltctl --verbose --release ${{ env.TARGET_FLAGS }} if [ "${{ matrix.os }}" = "windows-latest" ]; then @@ -163,12 +163,10 @@ jobs: - name: Strip release binary (macos) if: matrix.os == 'macos-latest' - shell: bash run: strip "$BIN" - name: Strip release binary (cross) if: env.CARGO == 'cross' && matrix.strip != '' - shell: bash run: | docker run --rm -v \ "$PWD/target:/target:Z" \ @@ -178,24 +176,20 @@ jobs: - name: Strip release binary (native strip) if: matrix.os != 'macos-latest' && matrix.strip == '' - shell: bash run: strip "$BIN" - name: Determine archive name - shell: bash run: | version="${{ needs.create-release.outputs.version }}" echo "ARCHIVE=gvltctl-${{ matrix.target }}" >> $GITHUB_ENV - name: Creating directory for archive - shell: bash run: | mkdir -p "$ARCHIVE" cp "$BIN" "$ARCHIVE"/ cp README.md "$ARCHIVE"/ - name: Build archive (Windows) - shell: bash if: matrix.os == 'windows-latest' run: | 7z a "$ARCHIVE.zip" "$ARCHIVE" @@ -204,7 +198,6 @@ jobs: echo "ASSET_SUM=$ARCHIVE.zip.sha256" >> $GITHUB_ENV - name: Build archive (Unix) - shell: bash if: matrix.os != 'windows-latest' run: | tar czf "$ARCHIVE.tar.gz" "$ARCHIVE" @@ -215,7 +208,6 @@ jobs: - name: Upload release archive env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - shell: bash run: | release_name="v${{ needs.create-release.outputs.version }}" gh release upload "$release_name" ${{ env.ASSET }} ${{ env.ASSET_SUM }}