CI #1248
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
schedule: | |
- cron: '0 2 * * 1-5' | |
env: | |
GOPROXY: "https://proxy.golang.org" | |
TAGS: "-tags=ci" | |
COVERAGE: "-coverpkg=github.com/go-p5/p5/..." | |
DISPLAY: ":99.0" | |
EGL_PLATFORM: "x11" | |
CI: "1" | |
jobs: | |
build: | |
name: Build | |
strategy: | |
matrix: | |
go-version: [1.20.x, 1.19.x] | |
platform: [ubuntu-20.04, windows-latest] | |
#platform: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache: true | |
- name: Cache-Go | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Install Linux packages | |
if: matrix.platform == 'ubuntu-20.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -qq pkg-config libwayland-dev libx11-dev libx11-xcb-dev libxkbcommon-dev libxkbcommon-x11-dev libgles2-mesa-dev libegl1-mesa-dev libffi-dev libxcursor-dev | |
# start a virtual frame buffer | |
Xvfb :99 -screen 0 1920x1024x24 & | |
- name: Build | |
run: | | |
go install -v $TAGS ./... | |
- name: Test Linux | |
if: matrix.platform == 'ubuntu-20.04' | |
run: | | |
go run ./ci/run-tests.go $TAGS -race $COVERAGE | |
- name: Test Windows | |
if: matrix.platform == 'windows-latest' | |
run: | | |
go test -v ./... | |
- name: static-check | |
uses: dominikh/staticcheck-action@v1 | |
with: | |
install-go: false | |
cache-key: ${{ matrix.platform }} | |
version: "2023.1" | |
- name: Upload-Coverage | |
if: matrix.platform == 'ubuntu-20.04' | |
uses: codecov/codecov-action@v3 |