Skip to content

CI

CI #646

Workflow file for this run

name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 2 * * 1-5'
env:
GOPROXY: "https://proxy.golang.org"
TAGS: "-race"
COVERAGE: "-coverpkg=github.com/go-lpc/mim/..."
jobs:
build:
name: Build
strategy:
matrix:
go-version: [1.20.x, 1.19.x]
platform: [ubuntu-latest]
#platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Cache-Go
uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
'%LocalAppData%\go-build'
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- name: Checkout code
uses: actions/checkout@v3
- name: Install Linux packages
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -qq pkg-config gcc-arm-linux-gnueabihf
- name: Build-Linux-32b-arm
if: matrix.platform == 'ubuntu-latest'
run: |
GOARCH=arm CGO_ENABLED=0 \
CC=arm-linux-gnueabihf-gcc \
CC_FOR_TARGET=arm-linux-gnueabihf-gcc \
go install -v ./...
- name: Build-Linux-64b
if: matrix.platform == 'ubuntu-latest'
run: |
GOARCH=amd64 go install -v $TAGS ./...
- name: Test Linux
if: matrix.platform == 'ubuntu-latest'
run: |
go run ./ci/run-tests.go $TAGS $COVERAGE
- name: static-check
uses: dominikh/staticcheck-action@v1.2.0
with:
install-go: false
cache-key: ${{ matrix.platform }}
version: "2023.1"
- name: Upload-Coverage
if: matrix.platform == 'ubuntu-latest'
uses: codecov/codecov-action@v1