Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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
25 changes: 0 additions & 25 deletions .github/workflows/test.yml

This file was deleted.