diff options
author | tummychow <tummychow@users.noreply.github.com> | 2022-11-17 15:17:28 -0500 |
---|---|---|
committer | tummychow <tummychow@users.noreply.github.com> | 2022-11-17 16:00:28 -0500 |
commit | bbc89e96540a6097072b8e556645761c7c748e28 (patch) | |
tree | fc25dcbb2c4bb96f75d593f5a23bc6c14da5c532 | |
parent | 8c54c46101b5dab8828a5d053f9147e148fd0eed (diff) |
update release workflow
the msvc targets don't work nicely with cross due to licensing issues,
so we build those natively. this also means we can't support i686 msvc
anymore, since the architecture would require cross compilation
-rw-r--r-- | .github/workflows/build.yml | 4 | ||||
-rw-r--r-- | .github/workflows/release.yml | 66 |
2 files changed, 26 insertions, 44 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a243ef7..f7bddb5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build +name: build on: [push, pull_request] @@ -12,7 +12,7 @@ jobs: matrix: os: [windows-latest, ubuntu-latest, macOS-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Build run: cargo build --release --verbose - name: Run tests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ab4f400..415f77d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,16 +19,16 @@ on: push: # Enable when testing release infrastructure on a branch + set a GA_VERSION a few lines below # branches: - # - tummychow/work + # - release-twiddling tags: - "[0-9]+.[0-9]+.[0-9]+" jobs: create-release: name: create-release runs-on: ubuntu-latest -# env: + # env: # Set to force version number, e.g., when no tag exists. -# GA_VERSION: TEST-0.0.4 + # GA_VERSION: TEST-0.6.8 outputs: upload_url: ${{ steps.release.outputs.upload_url }} GA_VERSION: ${{ env.GA_VERSION }} @@ -57,52 +57,44 @@ jobs: needs: ['create-release'] runs-on: ${{ matrix.os }} env: - # For some builds, we use cross to test on 32-bit and big-endian - # systems. - CARGO: cargo - # When CARGO is set to CROSS, this is set to `--target matrix.target`. - TARGET_FLAGS: "" - # When CARGO is set to CROSS, TARGET_DIR includes matrix.target. - TARGET_DIR: ./target # Emit backtraces on panics. RUST_BACKTRACE: 1 - # Build static releases with PCRE2. - PCRE2_SYS_STATIC: 1 strategy: matrix: - build: [linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc] + build: [linux, linux-arm, macos, win-msvc, win-gnu] include: - # Use an old linux distro to link against an old glibc to not get problems on older distros + # cross doesn't support the darwin/msvc targets unless you build their dockerfiles locally, due to licensing issues + # https://github.com/cross-rs/cross-toolchains + # so we only use it for the linux targets that require other architectures/libcs - build: linux - os: ubuntu-18.04 + os: ubuntu-latest rust: nightly target: x86_64-unknown-linux-musl + cross: true - build: linux-arm - os: ubuntu-18.04 + os: ubuntu-latest rust: nightly target: arm-unknown-linux-gnueabihf + cross: true - build: macos os: macos-latest rust: nightly target: x86_64-apple-darwin + cross: false - build: win-msvc - os: windows-2019 + os: windows-latest rust: nightly target: x86_64-pc-windows-msvc + cross: false - build: win-gnu - os: windows-2019 + os: windows-latest rust: nightly-x86_64-gnu target: x86_64-pc-windows-gnu - - build: win32-msvc - os: windows-2019 - rust: nightly - target: i686-pc-windows-msvc + cross: false steps: - name: Checkout repository - uses: actions/checkout@v2 - with: - fetch-depth: 1 + uses: actions/checkout@v3 - name: Install Rust uses: actions-rs/toolchain@v1 @@ -112,22 +104,12 @@ jobs: override: true target: ${{ matrix.target }} - - name: Use Cross - shell: bash - run: | - cargo install cross - echo "CARGO=cross" >> $GITHUB_ENV - echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV - echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV - - - name: Show command used for Cargo - 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 - run: ${{ env.CARGO }} build --verbose --release ${{ env.TARGET_FLAGS }} + uses: actions-rs/cargo@v1 + with: + use-cross: ${{ matrix.cross }} + command: build + args: --release --verbose --target ${{ matrix.target }} - name: Strip release binary (linux and macos) if: matrix.build == 'linux' || matrix.build == 'macos' @@ -145,14 +127,14 @@ jobs: - name: Build archive shell: bash run: | - outdir="${{ env.TARGET_DIR }}/release" + outdir="./target/${{ matrix.target }}/release" staging="git-absorb-${{ needs.create-release.outputs.GA_VERSION }}-${{ matrix.target }}" mkdir -p "$staging"/doc cp {README.md,LICENSE.md} "$staging/" cp Documentation/{git-absorb.1,git-absorb.txt} "$staging/doc/" - if [ "${{ matrix.os }}" = "windows-2019" ]; then + if [ "${{ matrix.target }}" =~ .*windows.* ]; then cp "target/${{ matrix.target }}/release/git-absorb.exe" "$staging/" 7z a "$staging.zip" "$staging" echo "ASSET=$staging.zip" >> $GITHUB_ENV |