From 42826b85052179f617429bd96c61589ba6ddce65 Mon Sep 17 00:00:00 2001 From: Zhong Jianxin Date: Tue, 2 Jan 2024 20:12:53 +0800 Subject: [PATCH] test: Split shell and shell-bin to multiple jobs --- .github/workflows/test.yml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb6eeef..df876f5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -22,6 +22,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] + shell: [shell, shell-bin] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 @@ -44,9 +45,9 @@ jobs: run: echo "CACHE_TIMESTAMP=$(date +%s)" >> $GITHUB_ENV - uses: actions/cache/restore@v3 with: - key: pianotrans3-${{ matrix.os }}-${{ hashFiles('flake.*', 'nix/**') }}-${{ env.CACHE_TIMESTAMP }} + key: pianotrans-${{ matrix.os }}-${{ matrix.shell }}-${{ hashFiles('flake.*', 'nix/**') }}-${{ env.CACHE_TIMESTAMP }} restore-keys: | - pianotrans3-${{ matrix.os }}-${{ hashFiles('flake.*', 'nix/**') }} + pianotrans-${{ matrix.os }}-${{ matrix.shell }}-${{ hashFiles('flake.*', 'nix/**') }} path: | /nix/store /nix/var/nix/db/db.sqlite @@ -67,21 +68,15 @@ jobs: if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} with: limit-access-to-actor: true - - name: Build nix devShells + - name: Build nix devShell run: | mkdir -p ~/.local/state/nix/profiles - # build nix devShells, and create profile to prevent gc - echo "Build nix devShell.#shell" - nix --print-build-logs develop .#shell --profile ~/.local/state/nix/profiles/shell --command true - echo "Build nix devShell.#shell-bin" - nix --print-build-logs develop .#shell-bin --profile ~/.local/state/nix/profiles/shell-bin --command true - - name: Test transcribe with nixpkgs#torch + # build nix devShell, and create profile to prevent gc + echo "Build nix devShell" + nix --print-build-logs develop .#${{ matrix.shell }} --profile ~/.local/state/nix/profiles/shell --command true + - name: Test transcribe run: | - nix --print-build-logs develop .#shell --command ./PianoTrans.py --cli test/cut_liszt.opus test/cut_liszt.opus test/cut_liszt.opus test/cut_liszt.opus test/cut_liszt.opus - test -e test/cut_liszt.opus.mid - - name: Test transcribe with nixpkgs#torch-bin - run: | - nix --print-build-logs develop .#shell-bin --command ./PianoTrans.py --cli test/cut_liszt.opus test/cut_liszt.opus test/cut_liszt.opus test/cut_liszt.opus test/cut_liszt.opus + nix --print-build-logs develop .#${{ matrix.shell }} --command ./PianoTrans.py --cli test/cut_liszt.opus test/cut_liszt.opus test/cut_liszt.opus test/cut_liszt.opus test/cut_liszt.opus test -e test/cut_liszt.opus.mid - name: Nix GC run: | @@ -95,7 +90,7 @@ jobs: - uses: actions/cache/save@v3 if: ${{ env.CACHE_NEED_UPDATE == 'yes' }} with: - key: pianotrans3-${{ matrix.os }}-${{ hashFiles('flake.*', 'nix/**') }}-${{ env.CACHE_TIMESTAMP }} + key: pianotrans-${{ matrix.os }}-${{ matrix.shell }}-${{ hashFiles('flake.*', 'nix/**') }}-${{ env.CACHE_TIMESTAMP }} path: | /nix/store /nix/var/nix/db/db.sqlite