From d4495cc3bb128703b38ebc122dd209d716d1df59 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Fri, 10 Jun 2022 16:52:24 +1000 Subject: [PATCH] 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 --- .github/workflows/rust.yml | 61 ++++++-------------------------------- 1 file changed, 9 insertions(+), 52 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index abe55e7b..e0067ac1 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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