Merge job test into job build to speedup workflow

so that testing does not have to wait for all build jobs with different
configurations to finish before starting.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-10 16:52:24 +10:00
parent 3e5c7ec43f
commit d4495cc3bb
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -12,7 +12,7 @@ env:
jobs:
build:
name: Build
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
@ -90,6 +90,14 @@ jobs:
- name: Copy and rename utility
run: cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }}
- name: Test
run: for bin in $bins; do ./${{ matrix.output }} cargo-binstall --no-confirm $bin; $done
env:
bins: cargo-binstall
- name: "Test binstall with manifest"
run: ./${{ matrix.output }} cargo-binstall --manifest-path . --no-confirm
- name: Create archive (tgz, linux)
if: ${{ matrix.os != 'macos-latest' && matrix.os != 'windows-latest' }}
run: tar -czvf cargo-binstall-${{ matrix.target }}.tgz ${{ matrix.output }}
@ -117,54 +125,3 @@ jobs:
asset_name: cargo-binstall-${{ matrix.target }}.${{ matrix.archive }}
tag: ${{ github.ref }}
overwrite: true
test:
name: Test
runs-on: ${{ matrix.os }}
needs: build
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
output: cargo-binstall
archive: tgz
- target: x86_64-apple-darwin
os: macos-latest
output: cargo-binstall
archive: zip
- target: x86_64-pc-windows-msvc
os: windows-latest
output: cargo-binstall.exe
archive: zip
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
output: cargo-binstall
archive: tgz
steps:
- uses: actions/checkout@v2
- uses: FranzDiebold/github-env-vars-action@v1.2.1
- uses: actions/download-artifact@v2
with:
name: cargo-binstall-${{ matrix.target }}.${{ matrix.archive }}
- name: "Extract build artifact (tgz, linux)"
if: ${{ matrix.os != 'windows-latest' && matrix.os != 'macos-latest' }}
run: tar -xvf cargo-binstall-${{ matrix.target }}.tgz
- name: "Extract build artifact (zip, windows)"
if: ${{ matrix.os == 'windows-latest' }}
run: tar.exe -xvf cargo-binstall-${{ matrix.target }}.zip
- name: "Extract build artifact (zip, macos)"
if: ${{ matrix.os == 'macos-latest' }}
run: unzip cargo-binstall-${{ matrix.target }}.zip
- name: "Run binstall"
run: ./${{ matrix.output }} cargo-binstall --no-confirm
- name: "Run binstall with manifest"
run: ./${{ matrix.output }} cargo-binstall --manifest-path . --no-confirm