mouthpiece/.github/workflows/build.yml

85 lines
2.6 KiB
YAML

on:
push:
branches-ignore:
- 'dependabot/**'
pull_request:
name: Build
jobs:
test:
strategy:
matrix:
go-version: [ 1.18.x ]
platform: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.platform }}
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: Install NPM
if: success()
uses: actions/setup-node@v3
with:
node-version: 16
- name: Checkout code
uses: actions/checkout@v1
- name: install Node Dependancies
run: cd frontend && npm install
- name: Build Frontend
run: cd frontend && npm run build
- name: Build
run: go build .
- name: Run tests
run: go test -v -race ./...
analyze:
name: Analyze
runs-on: ubuntu-latest
needs: [ test ]
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install NPM
if: success()
uses: actions/setup-node@v3
with:
node-version: 16
- name: Build Frontend
run: cd frontend && npm install && npm run build
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: go
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
codecov:
runs-on: ubuntu-latest
needs: [ test ]
steps:
- name: Install Go
if: success()
uses: actions/setup-go@v1
with:
go-version: 1.18.x
- name: Checkout code
uses: actions/checkout@v1
- name: Install NPM
if: success()
uses: actions/setup-node@v3
with:
node-version: 16
- name: Build Frontend
run: cd frontend && npm install && npm run build
- name: Run tests
run: go mod tidy && go test -v -race -covermode=atomic -coverprofile=coverage.out ./...
- name: CodeCov
uses: codecov/codecov-action@v2