-
Notifications
You must be signed in to change notification settings - Fork 8
77 lines (65 loc) · 1.95 KB
/
pull-requests.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
name: run tests
on:
pull_request:
branches: [ "main" ]
jobs:
linting:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
args: --issues-exit-code=0 --timeout=3m --verbose
unit-tests:
name: unit-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: go test -v -cover ./...
acceptance-tests:
name: acceptance-tests (terraform ${{ matrix.terraform-version }})
runs-on: ubuntu-latest
services:
commercelayer-mock:
image: wiremock/wiremock:2.34.0
ports:
- "8080:8080"
strategy:
fail-fast: false
matrix:
terraform-version:
- '1.0.*'
- '1.1.*'
- '1.2.*'
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform-version }}
terraform_wrapper: false
- name: load mock data
shell: bash
run: |
FILES="${{ github.workspace }}/mock/mappings/*"
for f in $FILES; do curl --location --request POST 'http://localhost:8080/__admin/mappings' --header 'Content-Type: application/json' --header 'Accept: application/json' --data-raw "$(cat "$f")"; done
- run: go test -v -p 1 ./...
env:
TF_ACC: '1'
COMMERCELAYER_CLIENT_ID: client-id
COMMERCELAYER_CLIENT_SECRET: client-secret
COMMERCELAYER_API_ENDPOINT: http://localhost:8080/api
COMMERCELAYER_AUTH_ENDPOINT: http://localhost:8080/oauth/token