diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-01-24 00:22:44 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-01-24 00:22:44 +0900 |
| commit | be144217759070f285084a578f3a634ecd4c43e9 (patch) | |
| tree | 283cc25d0c0bb10adc498775f71f4e3b8fbc3447 /.gitea/workflows/test.yml | |
| parent | 045983d7f419aff089e81f0e7c770dcf84f4a2eb (diff) | |
workflows: merge test build job into test
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to '.gitea/workflows/test.yml')
| -rw-r--r-- | .gitea/workflows/test.yml | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 4d7a871d..432c4290 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -5,7 +5,7 @@ on: - pull_request jobs: - tests: + test: name: Run NixOS test runs-on: ubuntu-latest steps: @@ -30,8 +30,8 @@ jobs: - name: Restore Nix store uses: nix-community/cache-nix-action@v5 with: - primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }} - restore-prefixes-first-match: nix-${{ runner.os }}- + primary-key: flake-check-${{ runner.os }}-${{ hashFiles('**/*.nix') }} + restore-prefixes-first-match: flake-check-${{ runner.os }}- - name: Run tests run: | @@ -44,3 +44,47 @@ jobs: name: "result" path: result/* retention-days: 1 + + dist: + name: Create distribution + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Install Nix + uses: cachix/install-nix-action@08dcb3a5e62fa31e2da3d490afc4176ef55ecd72 # v30 + with: + # explicitly enable sandbox + install_options: --daemon + extra_nix_config: | + sandbox = true + system-features = nixos-test benchmark big-parallel kvm + enable_kvm: true + + - name: Ensure environment + run: >- + apt-get update && apt-get install -y sqlite3 + if: ${{ runner.os == 'Linux' }} + + - name: Restore Nix store + uses: nix-community/cache-nix-action@v5 + with: + primary-key: build-dist-${{ runner.os }}-${{ hashFiles('**/*.nix') }} + restore-prefixes-first-match: build-dist-${{ runner.os }}- + + - name: Build for test + id: build-test + run: >- + export FORTIFY_REV="$(git rev-parse --short HEAD)" && + sed -i.old 's/version = /version = "0.0.0-'$FORTIFY_REV'"; # version = /' package.nix && + nix build --print-out-paths --print-build-logs .#dist && + mv package.nix.old package.nix && + echo "rev=$FORTIFY_REV" >> $GITHUB_OUTPUT + + - name: Upload test build + uses: actions/upload-artifact@v3 + with: + name: "fortify-${{ steps.build-test.outputs.rev }}" + path: result/* + retention-days: 1 |
