-
Notifications
You must be signed in to change notification settings - Fork 10
71 lines (60 loc) · 1.77 KB
/
parser-checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Parser Checks
on:
pull_request:
types: [ opened, synchronize, reopened ]
paths:
- 'solution/parser/**'
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
parser-checks:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
dir: ["ecfr-parser", "fr-parser", "lib/ecfr", "lib/eregs", "lib/fedreg", "lib/network", "lib/parsexml"]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Setup Go
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '^1.16' # The Go version to download (if necessary) and use.
# set up build cache
- name: Set up build cache
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/go/bin
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# Run go fmt on the code
- name: Run gofmt
uses: Jerome1337/gofmt-action@v1.0.5
with:
gofmt-path: './solution/parser/${{ matrix.dir }}'
gofmt-flags: '-l -d'
- uses: dominikh/staticcheck-action@v1.3.0
with:
version: "2022.1.3"
working-directory: "./solution/parser/${{ matrix.dir }}"
# Run lint on the code
- name: Run lint
run: |
go install golang.org/x/lint/golint@latest
pushd solution/parser/${{ matrix.dir }}
golint -set_exit_status ./...
popd
# Run tests and create coverage report
- name: Run tests
run: |
pushd solution/parser/${{ matrix.dir }}
go test -cover ./...
popd