-
Notifications
You must be signed in to change notification settings - Fork 24
100 lines (85 loc) · 3.08 KB
/
stack.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Stack CI
on:
workflow_call:
inputs:
os:
required: true
type: string
jobs:
build:
name: Build
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Cache Stack dirs (Linux/macOS)
if: runner.os != 'Windows'
uses: ./.github/template/stack-cache
# We set `key-always-unique` to "true" for Windows to ensure that Agda, which is build with
# Stack in the `test-windows` job, is added to cache. This reduces the number of times that
# Agda needs to be built and therefore significantly decreases average CI runtime on Windows.
- name: Cache Stack dirs (Windows)
if: runner.os == 'Windows'
uses: ./.github/template/stack-cache
with:
key-always-unique: "true"
- name: Build package and tests
run: |
stack test --no-run-tests
test:
needs: [ build ]
name: Test
runs-on: ${{ inputs.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Cache Stack dirs (Linux/macOS)
if: runner.os != 'Windows'
uses: ./.github/template/stack-cache
# We set `key-always-unique` to "true" for Windows to ensure that Agda, which is build with
# Stack in the `test-windows` job, is added to cache. This reduces the number of times that
# Agda needs to be built and therefore significantly decreases average CI runtime on Windows.
- name: Cache Stack dirs (Windows)
if: runner.os == 'Windows'
uses: ./.github/template/stack-cache
with:
key-always-unique: "true"
# We use Nix to install test dependencies on Linux and macOS since it's much faster for Agda,
# and also reduces how much we need to cache with the `cache` action.
- name: Install Nix
if: runner.os != 'Windows'
uses: cachix/install-nix-action@v26
with:
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Install test dependencies (Windows)
if: runner.os == 'Windows'
run: |
choco install neovim
stack install Agda
"$env:HOMEPATH\AppData\Roaming\local\bin" >> $env:GITHUB_PATH
"C:\tools\neovim\nvim-win64\bin" >> $env:GITHUB_PATH
- name: Create Neovim swap dirs
shell: bash
run: |
if [ $RUNNER_OS == "Windows" ]; then
mkdir -p ~/AppData/Roaming/local/share/nvim/swap
mkdir -p ~/AppData/Roaming/local/state/nvim/swap
else
mkdir -p ~/.local/share/nvim/swap
mkdir -p ~/.local/state/nvim/swap
fi
# Tests can be flaky so we retry them a few times.
- name: Run tests
uses: nick-fields/retry@v3
with:
timeout_minutes: 20
max_attempts: 3
retry_wait_seconds: 1
shell: bash
command: |
if [ $RUNNER_OS = "Windows" ]; then
stack test
else
nix shell nixpkgs#agda nixpkgs#neovim -c stack test
fi