mouthpiece/.github/workflows/build.yml

86 lines
2.6 KiB
YAML
Raw Permalink Normal View History

2022-07-13 11:05:08 +08:00
on:
push:
branches-ignore:
2022-08-16 16:11:52 +08:00
- 'dependabot/**'
2022-07-13 11:05:08 +08:00
pull_request:
2022-08-03 14:44:05 +08:00
2022-07-13 11:05:08 +08:00
name: Build
jobs:
test:
strategy:
matrix:
2022-08-03 14:44:05 +08:00
go-version: [ 1.18.x ]
2022-07-13 11:05:08 +08:00
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 }}
2022-08-12 21:03:18 +08:00
- name: Install NPM
if: success()
uses: actions/setup-node@v3
with:
node-version: 16
2022-07-13 11:05:08 +08:00
- name: Checkout code
uses: actions/checkout@v1
2022-08-12 21:03:18 +08:00
- name: install Node Dependancies
run: cd frontend && npm install
- name: Build Frontend
run: cd frontend && npm run build
2022-08-03 14:58:26 +08:00
- name: Build
run: go build .
2022-07-13 11:05:08 +08:00
- name: Run tests
run: go test -v -race ./...
analyze:
name: Analyze
2022-08-03 14:44:05 +08:00
runs-on: ubuntu-latest
needs: [ test ]
2022-07-13 11:05:08 +08:00
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
2022-08-16 11:42:52 +08:00
- name: Install NPM
2022-08-16 11:44:43 +08:00
if: success()
uses: actions/setup-node@v3
with:
node-version: 16
2022-08-16 11:42:52 +08:00
- name: Build Frontend
run: cd frontend && npm install && npm run build
2022-07-13 11:05:08 +08:00
- 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
2022-08-03 14:44:05 +08:00
needs: [ test ]
2022-07-13 11:05:08 +08:00
steps:
- name: Install Go
2022-08-16 12:14:29 +08:00
if: success()
uses: actions/setup-go@v1
with:
go-version: 1.18.x
- name: Checkout code
2022-08-16 12:14:29 +08:00
uses: actions/checkout@v1
- name: Install NPM
2022-08-16 12:14:29 +08:00
if: success()
uses: actions/setup-node@v3
with:
node-version: 16
- name: Build Frontend
2022-08-16 12:14:29 +08:00
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