Skip to content

github/workflows: support multiple GOOS #5

github/workflows: support multiple GOOS

github/workflows: support multiple GOOS #5

Workflow file for this run

name: Test
on:
push:
branches:
- "main"
pull_request:
defaults:
run:
shell: bash
env:
LLVM_VERSION: 15
# for Homebrew: https://docs.brew.sh/Manpage
HOMEBREW_PREFIX: /usr/local/Homebrew
HOMEBREW_BOOTSNAP: 1
HOMEBREW_CACHE: "$HOME/.cache/homebrew"
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
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 }}
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: Install latest LLVM
if: matrix.os != 'windows-2022'
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; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> ${GITHUB_ENV}
fi
mkdir -p ${HOMEBREW_CACHE}
brew install llvm@${LLVM_VERSION}
- name: Cache brewed LLVM
if: matrix.os != 'windows-2022'
uses: actions/cache@v3
with:
key: ${{ matrix.os }}-homebrew
path: $[HOMEBREW_CACHE}
- name: Test
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