Skip to content

Commit e9707cc

Browse files
committed
ci: merge tests into one job using a matrix
1 parent bba3c70 commit e9707cc

File tree

1 file changed

+20
-89
lines changed

1 file changed

+20
-89
lines changed

.github/workflows/test.yml

+20-89
Original file line numberDiff line numberDiff line change
@@ -6,113 +6,44 @@ name: Test
66
on: [push, pull_request]
77

88
jobs:
9-
test-macos-llvm-14:
9+
test-macos:
1010
runs-on: macos-latest
11+
strategy:
12+
matrix:
13+
llvm: [14, 15, 16, 17]
1114
steps:
1215
- name: Checkout
1316
uses: actions/checkout@v2
17+
- name: Update Homebrew
18+
if: matrix.llvm == 17 # needed as long as LLVM 17 is still fresh
19+
run: brew update
1420
- name: Install LLVM
15-
run: |
16-
brew update
17-
brew install llvm@14
18-
- name: Test LLVM 14
21+
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install llvm@${{ matrix.llvm }}
22+
- name: Test LLVM ${{ matrix.llvm }}
1923
run:
20-
go test -v -tags=llvm14
21-
test-macos-llvm-15:
22-
runs-on: macos-latest
23-
steps:
24-
- name: Checkout
25-
uses: actions/checkout@v2
26-
- name: Install LLVM
27-
run: |
28-
brew update
29-
brew install llvm@15
30-
- name: Test LLVM 15
31-
run:
32-
go test -v -tags=llvm15
33-
test-macos-llvm-16:
34-
runs-on: macos-latest
35-
steps:
36-
- name: Checkout
37-
uses: actions/checkout@v2
38-
- name: Install LLVM
39-
run: |
40-
brew update
41-
brew install llvm@16
42-
- name: Test LLVM 16
43-
run:
44-
go test -v -tags=llvm16
24+
go test -v -tags=llvm${{ matrix.llvm }}
4525
- name: Test default LLVM
26+
if: matrix.llvm == 16
4627
run:
4728
go test -v
48-
test-macos-llvm-17:
49-
runs-on: macos-latest
50-
steps:
51-
- name: Checkout
52-
uses: actions/checkout@v2
53-
- name: Install LLVM
54-
run: |
55-
brew update
56-
brew install llvm@17
57-
- name: Test LLVM 17
58-
run:
59-
go test -v -tags=llvm17
60-
test-linux-llvm-14:
29+
test-linux:
6130
runs-on: ubuntu-20.04
31+
strategy:
32+
matrix:
33+
llvm: [14, 15, 16, 17]
6234
steps:
6335
- name: Checkout
6436
uses: actions/checkout@v2
6537
- name: Install LLVM
6638
run: |
67-
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' | sudo tee /etc/apt/sources.list.d/llvm.list
39+
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-${{ matrix.llvm }} main' | sudo tee /etc/apt/sources.list.d/llvm.list
6840
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
6941
sudo apt-get update
70-
sudo apt-get install --no-install-recommends llvm-14-dev
71-
- name: Test LLVM 14
42+
sudo apt-get install --no-install-recommends llvm-${{ matrix.llvm }}-dev
43+
- name: Test LLVM ${{ matrix.llvm }}
7244
run:
73-
go test -v -tags=llvm14
74-
test-linux-llvm-15:
75-
runs-on: ubuntu-20.04
76-
steps:
77-
- name: Checkout
78-
uses: actions/checkout@v2
79-
- name: Install LLVM
80-
run: |
81-
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main' | sudo tee /etc/apt/sources.list.d/llvm.list
82-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
83-
sudo apt-get update
84-
sudo apt-get install --no-install-recommends llvm-15-dev
85-
- name: Test LLVM 15
86-
run:
87-
go test -v -tags=llvm15
88-
test-linux-llvm-16:
89-
runs-on: ubuntu-20.04
90-
steps:
91-
- name: Checkout
92-
uses: actions/checkout@v2
93-
- name: Install LLVM
94-
run: |
95-
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-16 main' | sudo tee /etc/apt/sources.list.d/llvm.list
96-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
97-
sudo apt-get update
98-
sudo apt-get install --no-install-recommends llvm-16-dev
99-
- name: Test LLVM 16
100-
run:
101-
go test -v -tags=llvm16
45+
go test -v -tags=llvm${{ matrix.llvm }}
10246
- name: Test default LLVM
47+
if: matrix.llvm == 16
10348
run:
10449
go test -v
105-
test-linux-llvm-17:
106-
runs-on: ubuntu-20.04
107-
steps:
108-
- name: Checkout
109-
uses: actions/checkout@v2
110-
- name: Install LLVM
111-
run: |
112-
echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-17 main' | sudo tee /etc/apt/sources.list.d/llvm.list
113-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
114-
sudo apt-get update
115-
sudo apt-get install --no-install-recommends llvm-17-dev
116-
- name: Test LLVM 17
117-
run:
118-
go test -v -tags=llvm17

0 commit comments

Comments
 (0)