forked from incentro-ecx/terraform-provider-commercelayer
-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (69 loc) · 2.1 KB
/
tests.yaml
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
81
82
83
84
name: Run Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
services:
commercelayer-mock:
image: wiremock/wiremock:2.34.0
ports:
- "8080:8080"
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.3.7
terraform_wrapper: false
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Set up Task
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: golangci-lint
continue-on-error: true
uses: golangci/golangci-lint-action@v6
with:
args: --issues-exit-code=0 --timeout=5m
- 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
- name: Run tests
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
- name: Upload to codecov
uses: codecov/codecov-action@v4
with:
verbose: true
- name: build binary
uses: goreleaser/goreleaser-action@v6
with:
args: build --snapshot --clean --single-target
env:
GOPATH: ${{ env.GOPATH }}
changie:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
permissions:
contents: write
pull-requests: write
actions: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare release
uses: labd/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
release-workflow: 'release.yaml'