-
Notifications
You must be signed in to change notification settings - Fork 43
73 lines (62 loc) · 2.24 KB
/
wf_check.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
on:
workflow_call:
inputs:
NAME:
type: string
required: true
GIT_REF:
type: string
required: false
jobs:
tests:
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: write
runs-on: ubuntu-22.04
timeout-minutes: 180
steps:
- name: "Check out repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.GIT_REF }}
- uses: cachix/install-nix-action@v30
with:
install_url: "https://releases.nixos.org/nix/nix-2.22.3/install"
install_options: "--no-daemon"
extra_nix_config: |
experimental-features = nix-command flakes
sandbox = false
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
substituters = https://cache.nixos.org/?priority=40
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
- uses: DeterminateSystems/magic-nix-cache-action@v8
with:
diagnostic-endpoint: ""
use-flakehub: false
- name: "Verify if we need to build"
id: verify-build
run: |
export drvPath=$(make check-dry-run)
echo "drvPath - $drvPath"
nix store verify --no-trust --store http://127.0.0.1:37515 $drvPath \
&& export BUILD_NEEDED=no \
|| export BUILD_NEEDED=yes
echo BUILD_NEEDED=$BUILD_NEEDED >> $GITHUB_OUTPUT
echo DERIVATION_PATH=$drvPath >> $GITHUB_OUTPUT
- name: "Start containters for integration tests"
run: |
make build-docker-image
nix develop -c make dev-env-up
if: ${{ steps.verify-build.outputs.BUILD_NEEDED == 'yes' }}
- name: "Run checks"
run: make check
if: ${{ steps.verify-build.outputs.BUILD_NEEDED == 'yes' }}
- name: "Cache checks"
run: |
# DEPENDENCIES=($(nix-store --query --requisites --include-outputs ${{ steps.verify-build.outputs.DERIVATION_PATH }}))
# nix copy --to http://127.0.0.1:37515 "${DEPENDENCIES[@]}" || exit 0
nix copy --to http://127.0.0.1:37515 ${{ steps.verify-build.outputs.DERIVATION_PATH }}|| exit 0
if: ${{ steps.verify-build.outputs.BUILD_NEEDED == 'yes' }}