-
Notifications
You must be signed in to change notification settings - Fork 41
149 lines (123 loc) Β· 4.84 KB
/
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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# This is a basic workflow to help you get started with Actions
name: Test
defaults:
run:
shell: bash
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master, dev, ci ]
pull_request:
branches: [ master, dev, ci ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build-and-test:
# Runs on all major platforms
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
agda: ["Agda-2.7.0"]
# agda: ["Agda-2.6.4", "Agda-2.7.0"]
fail-fast: false
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: π₯ Checkout repository
uses: actions/checkout@v4
# actions:
- name: β¬ Setup Haskell environment
id: haskell-setup
uses: haskell-actions/setup@v2
with:
ghc-version: '9.2.8'
stack-version: latest
cabal-update: false
enable-stack: true
# $DIST is where the binary & its dependencies is placed
- name: π οΈ Setting variables
run: |
echo "STACK_LOCAL_BIN=$(stack path --local-bin)" >> "$GITHUB_ENV"
echo "DIST=${{ matrix.agda }}-${{ matrix.os }}" >> "$GITHUB_ENV"
- name: π Reviewing variables
run: |
echo "runner.os = ${{ runner.os }}"
echo "ghc-path = ${{ steps.haskell-setup.outputs.ghc-path }}"
echo "ghc-exe = ${{ steps.haskell-setup.outputs.ghc-exe }}"
echo "stack-path = ${{ steps.haskell-setup.outputs.stack-path }}"
echo "stack-exe = ${{ steps.haskell-setup.outputs.stack-exe }}"
echo "stack-root = ${{ steps.haskell-setup.outputs.stack-root }}"
echo "STACK_LOCAL_BIN = $STACK_LOCAL_BIN"
echo "DIST = $DIST"
# cached stuff to be restored:
- name: πΎ Restore cached stack global package db
id: stack-global
uses: actions/cache/restore@v4
with:
path: ${{ steps.haskell-setup.outputs.stack-root }}
key: ${{ runner.os }}-stack-global-${{ matrix.agda }}
restore-keys: |
${{ runner.os }}-stack-global
- name: πΎ Restore stack-installed binaries in ~/.local/bin
id: stack-binaries
uses: actions/cache/restore@v4
with:
path: ${{ env.STACK_LOCAL_BIN }}
key: ${{ runner.os }}-stack-binaries-${{ matrix.agda }}
restore-keys: |
${{ runner.os }}-stack-binaries
- name: β¬ Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: π Check if Agda has been installed
id: check-agda
continue-on-error: true
run: which agda
- name: β¬ Install Agda
if: ${{ steps.check-agda.outcome == 'failure'}}
run: |
stack install --resolver=lts-20.26 ${{ matrix.agda }}
which agda
agda --version
- name: π¦ Move artefacts to ${{ env.DIST }}
continue-on-error: true
run: |
dist=${{ env.DIST }}
mkdir -p "${dist}"
if [[ ${{ runner.os }} == "Windows" ]]; then
cp ${{ env.STACK_LOCAL_BIN }}/agda "${dist}"
else
cp ${{ env.STACK_LOCAL_BIN }}/agda "${dist}"
fi
ls "${dist}"
strip "${dist}"/agda
file "${dist}"/agda
- name: π οΈ Add ${{ env.DIST }} to PATH
run: echo ${{ env.DIST }} >> $GITHUB_PATH
- name: π Check if Agda has been installed again
continue-on-error: true
run: which agda
# things to be cached
- name: πΎ Cache stack global package db
if: always() && env.AGDA_INSTALLED != '0' && steps.stack-global.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ steps.haskell-setup.outputs.stack-root }}
key: ${{ steps.stack-global.outputs.cache-primary-key }}
- name: πΎ Cache stack-installed binaries
if: always() && env.AGDA_INSTALLED != '0' && steps.stack-binaries.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ env.STACK_LOCAL_BIN }}
key: ${{ steps.stack-binaries.outputs.cache-primary-key }}
- name: β¬ Install NPM Dependencies
run: npm install
- name: π¨ Build stuff
run: npm run build
- name: π Run tests (Linux)
if: runner.os == 'Linux'
run: xvfb-run -a npm test
- name: π Run tests (Windows, MacOS)
if: runner.os != 'Linux'
run: npm test