go.yml

 1name: Go build and test
 2
 3on:
 4  push:
 5    branches: [ master ]
 6  pull_request:
 7    branches: [ master ]
 8  workflow_dispatch:
 9
10concurrency:
11  group: go-${{ github.ref }}
12  cancel-in-progress: true
13
14jobs:
15  build:
16
17    strategy:
18      matrix:
19        go-version: [1.22.5]
20        platform: [ubuntu-latest, macos-latest, windows-latest]
21
22    runs-on: ${{ matrix.platform }}
23
24    steps:
25
26      - name: Set up Go ${{ matrix.node-version }}
27        uses: actions/setup-go@v5
28        with:
29          go-version: ${{ matrix.go-version }}
30
31      - name: Check out code
32        uses: actions/checkout@v4
33
34      - name: Build
35        run: make
36
37      - name: Test
38        run: make test
39        env:
40          GITHUB_TEST_USER: ${{ secrets._GITHUB_TEST_USER }}
41          GITHUB_TOKEN_ADMIN: ${{ secrets._GITHUB_TOKEN_ADMIN }}
42          GITHUB_TOKEN_PRIVATE: ${{ secrets._GITHUB_TOKEN_PRIVATE }}
43          GITHUB_TOKEN_PUBLIC: ${{ secrets._GITHUB_TOKEN_PUBLIC }}
44          GITLAB_API_TOKEN: ${{ secrets.GITLAB_API_TOKEN }}
45          GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }}
46  
47  lint:
48    runs-on: ubuntu-latest
49    steps:
50      - name: Install Go
51        uses: actions/setup-go@v5
52        with:
53          go-version: 1.19.4
54
55      - name: Checkout code
56        uses: actions/checkout@v4
57
58      - name: Check Code Formatting
59        run: find . -name "*.go" | while read line; do [ -z "$(gofmt -d "$line" | head)" ] || exit 1; done