Core

/.github/workflows/test.yml (2.0 KB)

 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
name: test
on:
workflow_call:
push:
tags:
- "*"
branches:
- main
- master
pull_request:
branches: [ main, master ]
permissions:
contents: write
jobs:
build:
runs-on: "ubuntu-latest"
# $PF_SECTION_START(setup)$
# $PF_SECTION_END(setup)$
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 0
- name: "Golang"
uses: "actions/setup-go@v2"
with:
go-version: "{{{ .GoVersionSafe }}}"
- name: "Cache"
uses: "actions/cache@v2"
with:
path: "~/go/pkg/mod"
key: "${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}"
restore-keys: |
${{ runner.os }}-go-
- name: "Dependencies"
run: "bin/bootstrap.sh"
- name: "Config"
env:
OWNER: "${{ github.repository_owner }}"
TOKEN: "${{ secrets.CR_PAT }}"
run: "git config --global url.\"https://${OWNER}:${TOKEN}@github.com\".insteadOf \"https://github.com\""
- name: "Templates"
run: "bin/templates.sh"
- name: "Modules"
run: "go mod download"
env:
GOPRIVATE: "github.com/${{ github.repository_owner }}"
GITHUB_TOKEN: "${{ secrets.CR_PAT }}"
OWNER: "${{ github.repository_owner }}"
TOKEN: "${{ secrets.CR_PAT }}"
- name: "Test"
run: |
if [ -f "test.env" ]; then
export $(cat test.env | grep -v "#" | xargs)
fi
if [ -f "./bin/test-setup.sh" ]; then
./bin/test-setup.sh
fi
go test -race -json ./app/... > test.json
env:
GOPRIVATE: "github.com/${{ github.repository_owner }}"
GITHUB_TOKEN: "${{ secrets.CR_PAT }}"
OWNER: "${{ github.repository_owner }}"
TOKEN: "${{ secrets.CR_PAT }}"
- name: "Annotate"
if: always()
uses: guyarb/golang-test-annotations@v0.5.0
with:
test-results: test.json