| 1 |
|
| 2 |
on: [push, pull_request] |
| 3 |
|
| 4 |
jobs: |
| 5 |
test: |
| 6 |
name: Test clang-${{ matrix.clang }} |
| 7 |
runs-on: ubuntu-22.04 |
| 8 |
|
| 9 |
strategy: |
| 10 |
matrix: |
| 11 |
clang: ["11", "14", "20"] |
| 12 |
|
| 13 |
steps: |
| 14 |
- name: Set up Go 1.x |
| 15 |
uses: actions/setup-go@v2 |
| 16 |
with: |
| 17 |
go-version: ^1.24 |
| 18 |
|
| 19 |
- name: Check out code into the Go module directory |
| 20 |
uses: actions/checkout@v2 |
| 21 |
|
| 22 |
- name: Add apt.llvm.org repo |
| 23 |
|
| 24 |
if: matrix.clang != 11 |
| 25 |
run: | |
| 26 |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add - |
| 27 |
echo 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{ matrix.clang }} main' | sudo tee /etc/apt/sources.list.d/clang.list |
| 28 |
# Only update the llvm repo, this is a lot faster. |
| 29 |
sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/clang.list" -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0" |
| 30 |
|
| 31 |
- name: Install clang |
| 32 |
run: sudo apt-get install -y clang-${{ matrix.clang }} |
| 33 |
|
| 34 |
- name: Check lint |
| 35 |
|
| 36 |
run: test -z $(gofmt -l ./ | tee /dev/stderr) |
| 37 |
|
| 38 |
- name: Run tests |
| 39 |
env: |
| 40 |
CLANG: clang-${{ matrix.clang }} |
| 41 |
|
| 42 |
run: sudo -E env "PATH=$PATH" go test ./... |