Skip to content

github/workflows: support multiple GOOS #13

github/workflows: support multiple GOOS

github/workflows: support multiple GOOS #13

Workflow file for this run

name: Test
on:
push:
branches:
- "main"
pull_request:
defaults:
run:
shell: bash
env:
LLVM_VERSION: 15
jobs:
test:
strategy:
matrix:
os:
- "ubuntu-22.04" # https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
- "macos-13" # https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
go-version:
- "1.20.x"
- "1.21.x"
fail-fast: false
runs-on:
labels: ${{ matrix.os }}
env:
# for Homebrew: https://docs.brew.sh/Manpage
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CURL_VERBOSE: 1
HOMEBREW_DEVELOPER: 1
HOMEBREW_DISPLAY_INSTALL_TIMES: 1
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_INSTALL_UPGRADE: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
HOMEBREW_VERBOSE: 1
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
check-latest: true
- name: Setup install LLVM
if: matrix.os == 'ubuntu-22.04'
run: |
if ! command -v brew > /dev/null 2>&1; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "PATH=/home/linuxbrew/.linuxbrew/bin:$PATH" >> ${GITHUB_ENV}
fi
echo "HOMEBREW_CACHE=${HOME}/.cache/Homebrew" >> ${GITHUB_ENV}
echo "CPPFLAGS=-I${HOMEBREW_PREFIX}/opt/llvm@15/include:${CPPFLAGS}" >> ${GITHUB_ENV}
echo "LDFLAGS=-L${HOMEBREW_PREFIX}/opt/llvm@15/lib:${LDFLAGS}" >> ${GITHUB_ENV}
- name: Install latest LLVM toolchain
if: matrix.os == 'ubuntu-22.04'
run: |
mkdir -p ${HOMEBREW_CACHE}
brew install llvm@${LLVM_VERSION}
- name: Cache brewed LLVM
uses: actions/cache@v3
with:
key: ${{ matrix.os }}-homebrew
path: $[HOMEBREW_CACHE}
- name: Test
if: matrix.os == 'ubuntu-22.04'
run: |
docker container run -t \
--mount type=bind,src=$PWD,dst=/go/src/github.com/go-clang/clang-v${LLVM_VERSION} \
--workdir /go/src/github.com/go-clang/clang-v${LLVM_VERSION} \
ghcr.io/go-clang/base:${LLVM_VERSION} \
make test