-
Notifications
You must be signed in to change notification settings - Fork 96
166 lines (138 loc) · 5.04 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: Test
on:
workflow_call: # for Publish
push:
branches:
- master
pull_request:
branches:
- master
jobs:
setup:
runs-on: ubuntu-latest
outputs:
skip_tests: ${{ steps.check_for_skip.outputs.skip_tests }}
tests: ${{ steps.set-tests.outputs.tests }}
steps:
- uses: actions/checkout@v4
- name: Clojure deps cache
uses: actions/cache@v4
with:
path: |
~/.m2/repository
~/.deps.clj
~/.gitlibs
enableCrossOsArchive: true
key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }}
restore-keys: cljdeps-
- name: "Setup Java"
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Install Clojure Tools
uses: DeLaGuardo/[email protected]
with:
bb: 'latest'
# This assumes downloaded deps are same for all OSes
- name: Bring down deps
run: bb download-deps
- name: Check if Tests Should Run
id: check_for_skip
run: bb -ci-set-skip-tests
- id: set-tests
if: steps.check_for_skip.outputs.skip_tests == 'false'
name: Set test var for matrix
# run test.clj directly instead of via bb task to avoid generic task output
run: echo "tests=$(bb script/test_matrix.clj --format json)" >> $GITHUB_OUTPUT
build:
needs: setup
runs-on: ${{ matrix.os }}-latest
if: needs.setup.outputs.skip_tests == 'false'
strategy:
fail-fast: false
matrix:
include: ${{fromJSON(needs.setup.outputs.tests)}}
name: ${{ matrix.desc }}
steps:
- name: Don't convert line endings on checkout (Windows)
if: matrix.os == 'windows'
run: git config --global core.autocrlf false
- name: Tune Windows network
if: ${{ matrix.os == 'windows' }}
run: Disable-NetAdapterChecksumOffload -Name * -TcpIPv4 -UdpIPv4 -TcpIPv6 -UdpIPv6
- name: Tune macOS network
if: ${{ matrix.os == 'macos' }}
run: |
sudo sysctl -w net.link.generic.system.hwcksum_tx=0
sudo sysctl -w net.link.generic.system.hwcksum_rx=0
- name: Install Ubuntu X11 Utils
if: ${{ matrix.os == 'ubuntu' }}
run: sudo apt-get -y install x11-utils
- name: Install Linux Windows Manager
if: ${{ matrix.os == 'ubuntu' }}
run: sudo apt-get -y install fluxbox
# No longer pre-installed on macOS github action runners
- name: Install Image Magick on macOS
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'imagemagick') }}
run: brew install imagemagick
# No longer pre-installed on macOS github action runners
- name: Install Microsoft Edge on macOS
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'edge') }}
run: |
brew install --cask microsoft-edge
EDGE_VERSION=$(defaults read /Applications/Microsoft\ Edge.app/Contents/Info CFBundleShortVersionString)
MAJOR_VERSION=$(echo $EDGE_VERSION | cut -d'.' -f1)
DRIVER_VERSION=$(curl -s "https://msedgedriver.azureedge.net/LATEST_RELEASE_${MAJOR_VERSION}_MACOS" | iconv -f UTF-16LE -t UTF-8 | sed 's/^\xEF\xBB\xBF//' | tr -d '\r\n')
echo "Installing msedgedriver version ${DRIVER_VERSION} for Edge version ${EDGE_VERSION}"
DRIVER_URL="https://msedgedriver.azureedge.net/${DRIVER_VERSION}/edgedriver_mac64_m1.zip"
wget $DRIVER_URL
mkdir $RUNNER_TEMP/edgedriver
unzip edgedriver_mac64_m1.zip -d $RUNNER_TEMP/edgedriver
echo "$RUNNER_TEMP/edgedriver" >> $GITHUB_PATH
# No longer pre-installed on macOS github action runners
- name: Install Firefox on macOS
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'firefox') }}
run: |
brew install --cask firefox
brew install geckodriver
- uses: actions/checkout@v4
- name: Restore Clojure deps from cache
uses: actions/cache/restore@v4
with:
path: |
~/.m2/repository
~/.deps.clj
~/.gitlibs
enableCrossOsArchive: true
key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }}
restore-keys: cljdeps-
- name: Cache fixup for Windows
# cache is restored using relative paths from Linux, this is not appropriate for Windows
# this is admitedly fragile/hackey, will revisit if it cracks
if: ${{ matrix.os == 'windows' }}
run: |
mv ../../../.m2 ${USERPROFILE}
mv ../../../.deps.clj ${USERPROFILE}
mv ../../../.gitlibs ${USERPROFILE}
shell: bash
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.jdk-version }}
- name: Install Clojure Tools
uses: DeLaGuardo/[email protected]
with:
bb: 'latest'
- name: Tools versions
run: bb tools-versions
- name: Run Tests
run: ${{ matrix.cmd }}
- name: Upload test debug output
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.id }}-debug-screenshots
path: target/debug-screenshots/*
if-no-files-found: ignore