5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-26 06:01:37 +00:00
yggdrasil-go/.github/workflows/ci.yml

132 lines
2.7 KiB
YAML
Raw Normal View History

2022-04-17 16:24:34 +00:00
name: Yggdrasil
on:
push:
pull_request:
release:
2022-04-17 16:53:55 +00:00
workflow_dispatch:
2022-04-17 16:24:34 +00:00
2022-04-18 09:30:40 +00:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
2022-04-17 16:24:34 +00:00
jobs:
2022-04-17 16:53:55 +00:00
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
2022-08-06 14:19:01 +00:00
go-version: 1.19
2022-04-17 16:53:55 +00:00
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --issues-exit-code=1
2022-04-18 09:33:33 +00:00
codeql:
name: Analyse
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
2022-04-18 09:35:05 +00:00
languages: go
2022-04-18 09:33:33 +00:00
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
2022-04-17 16:53:55 +00:00
build-linux:
2022-04-17 16:24:34 +00:00
strategy:
2022-04-17 16:53:55 +00:00
fail-fast: false
2022-04-17 16:24:34 +00:00
matrix:
goversion: ["1.17", "1.18", "1.19", "1.20"]
2022-04-17 17:22:26 +00:00
2022-04-17 16:53:55 +00:00
name: Build & Test (Linux, Go ${{ matrix.goversion }})
needs: [lint]
2022-04-17 17:22:26 +00:00
2022-04-17 16:24:34 +00:00
runs-on: ubuntu-latest
steps:
2022-04-17 17:22:26 +00:00
- uses: actions/checkout@v3
2022-04-17 16:24:34 +00:00
2022-04-17 17:22:26 +00:00
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.goversion }}
2022-04-17 16:24:34 +00:00
2022-04-17 17:22:26 +00:00
- name: Build Yggdrasil
run: go build -v ./...
2022-04-17 16:24:34 +00:00
2022-04-17 17:22:26 +00:00
- name: Unit tests
run: go test -v ./...
2022-04-17 16:53:55 +00:00
build-windows:
strategy:
fail-fast: false
matrix:
goversion: ["1.17", "1.18", "1.19", "1.20"]
2022-04-17 17:22:26 +00:00
2022-04-17 16:53:55 +00:00
name: Build & Test (Windows, Go ${{ matrix.goversion }})
needs: [lint]
2022-04-17 17:22:26 +00:00
2022-04-17 16:53:55 +00:00
runs-on: windows-latest
steps:
2022-04-17 17:22:26 +00:00
- uses: actions/checkout@v3
2022-04-17 16:53:55 +00:00
2022-04-17 17:22:26 +00:00
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.goversion }}
- name: Build Yggdrasil
run: go build -v ./...
2022-04-17 16:53:55 +00:00
2022-04-17 17:22:26 +00:00
- name: Unit tests
run: go test -v ./...
2022-04-17 16:53:55 +00:00
build-macos:
strategy:
fail-fast: false
matrix:
goversion: ["1.17", "1.18", "1.19", "1.20"]
2022-04-17 17:22:26 +00:00
2022-04-17 16:53:55 +00:00
name: Build & Test (macOS, Go ${{ matrix.goversion }})
needs: [lint]
2022-04-17 17:22:26 +00:00
2022-04-17 16:53:55 +00:00
runs-on: macos-latest
steps:
2022-04-17 17:22:26 +00:00
- uses: actions/checkout@v3
2022-04-17 16:53:55 +00:00
2022-04-17 17:22:26 +00:00
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.goversion }}
2022-04-17 16:53:55 +00:00
2022-04-17 17:22:26 +00:00
- name: Build Yggdrasil
run: go build -v ./...
2022-04-17 16:53:55 +00:00
2022-04-17 17:22:26 +00:00
- name: Unit tests
run: go test -v ./...
2022-04-17 16:53:55 +00:00
tests-ok:
name: All tests passed
2022-04-18 09:33:33 +00:00
needs: [lint, codeql, build-linux, build-windows, build-macos]
2022-04-17 16:53:55 +00:00
runs-on: ubuntu-latest
if: ${{ !cancelled() }}
steps:
- name: Check all tests passed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}