-
Notifications
You must be signed in to change notification settings - Fork 2
110 lines (99 loc) · 3.42 KB
/
build.yml
File metadata and controls
110 lines (99 loc) · 3.42 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build
on:
pull_request:
branches:
- master
push:
branches:
- master
env:
PACT_BROKER_BASE_URL: https://testdemo.pactflow.io
PACT_BROKER_TOKEN: ${{ secrets.PACTFLOW_TOKEN_FOR_CI_CD_WORKSHOP }}
VITE_API_BASE_URL: http://localhost:8080
GIT_SHA: ${{ github.sha }}
GIT_REF: ${{ github.ref }}
PACT_URL: https://testdemo.pactflow.io/pacts/provider/pactflow-example-provider/consumer/pactflow-example-consumer-webhookless/version/${{ github.sha }}
jobs:
complete:
name: Test completion check
if: always()
permissions:
contents: none
runs-on: ubuntu-slim
needs:
- Test
- Verify
- Can-I-Deploy
steps:
- name: Failed
run: exit 1
if: >
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '25'
- name: Install
run: npm ci
- name: Type check
run: npm run type-check
- name: Lint
run: npm run check
- name: Build
run: npm run build
- name: Run tests
run: make test
- name: Publish pacts
run: GIT_BRANCH=${GITHUB_REF:11} make publish_pacts
Verify:
runs-on: ubuntu-latest
needs: Test
continue-on-error: true
steps:
- run: docker pull pactfoundation/pact-cli:latest
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Check if verification exists
# Raises an error and does not continue if the verification already exists
# Because continue-on-error is set to true, this will not fail the overall build however
run: "! make check_if_successfull_verification_exists"
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
repository: pactflow/example-provider
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: '25'
- name: Install
run: npm ci
- name: Verify
run: GIT_BRANCH=${GITHUB_REF:11} make ci_webhook
env:
PACT_BROKER_PUBLISH_VERIFICATION_RESULTS: true
GIT_BRANCH: master
# Could also check out and verify with the production version of the provider here in parallel.
# To get the prod version of the provider, do:
# pact-broker describe-version --pacticipant pactflow-example-provider --latest prod --output json | jq '.number' -r
# This is still required, as the verification done in the previous step is done by
# the latest version of the provider, not the production version.
Can-I-Deploy:
runs-on: ubuntu-latest
needs: Verify
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- run: docker pull pactfoundation/pact-cli:latest
- name: Can I deploy?
run: make can_i_deploy
# Only deploy from master
Deploy:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: Can-I-Deploy
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- run: docker pull pactfoundation/pact-cli:latest
- name: Deploy
run: GIT_BRANCH=${GITHUB_REF:11} make deploy