-
-
Notifications
You must be signed in to change notification settings - Fork 313
57 lines (47 loc) · 2 KB
/
devtools_test.yml
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
on:
pull_request:
name: Test the devtools nix files
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
devtools-test:
name: devtools-test
runs-on: [ubuntu-20.04]
timeout-minutes: 120
steps:
- uses: actions/checkout@v3
- name: Only run all steps if flake.lock or flake.nix changed
id: checklock
run: |
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep 'flake'; then
echo "A flake file was changed. Testing devtools nix files..."
echo "::set-output name=changed::true"
else
echo "No flake file was changed. No need to run tests."
echo "::set-output name=changed::false"
fi
- uses: cachix/install-nix-action@v23
if: steps.checklock.outputs.changed == 'true'
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: test devtools/flake.nix
if: steps.checklock.outputs.changed == 'true'
id: devtools_test_step
run: |
sed -i "s|/home/username/gitrepos/roc|$(realpath .)|g" devtools/flake.nix
cat devtools/flake.nix
mkdir -p ../temp
cp devtools/flake.nix ../temp
cp devtools/flake.lock ../temp
cd ../temp
git init
git add flake.nix flake.lock
nix develop
- name: Print tip on fail
if: steps.devtools_test_step.outcome == 'failure'
run: |
echo "The devtools test failed, this can likely be fixed by"
echo "locally deleting devtools/flake.lock and following the"
echo "instructions in devtools/README.md. This will create a"
echo "new flake.lock you should use to replace the old devtools/flake.lock"