-
-
Notifications
You must be signed in to change notification settings - Fork 36
80 lines (65 loc) · 1.77 KB
/
build_and_test.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
72
73
74
75
76
77
78
79
80
name: "Build and test"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./v2
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
cache: true
- name: Install BATS
run: |
git clone https://github.com/bats-core/bats-core.git
cd bats-core
sudo ./install.sh /usr/local
bats --version
cd ..
- name: Install BATS extras
run: |
cd tests
git clone https://github.com/bats-core/bats-support.git ./test_helpers/bats-support
git clone https://github.com/bats-core/bats-assert.git ./test_helpers/bats-assert
cd ..
- name: Install Go linter
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.46.2
- name: Install PHP
run: |
sudo apt-get update
sudo apt-get install -y php8.1
- name: Get dependencies
run: |
go mod tidy
go mod vendor
go mod verify
- name: Build
run: |
make
make version
- name: Lint
run: golangci-lint run || true
- name: Run unit tests
run: make test
- name: Run functional tests
run: ./ahoy test
- name: Run tests with coverage
run: |
go install gotest.tools/gotestsum@latest
mkdir -p /tmp/test-reports
gotestsum --junitfile /tmp/test-reports/unit-tests.xml
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: /tmp/test-reports/
retention-days: 30