forked from pactflow/example-provider
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (59 loc) · 2.54 KB
/
ProviderDesignFeedback.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
name: Provider Design Feedback
# Create/Edit OpenAPI Document in SwaggerHub or store OpenAPI document locally in env.oas_file_location below
# Sync OpenAPI -> SCM with Github Sync - https://support.smartbear.com/swaggerhub/docs/integrations/github-sync.html
# Version number = <OAS Version>-<GitHub Commit SHA>-design
# OpenAPI + Provider Test Report = Provider Contract Uploaded to PactFlow
# *** Test Report is just OAS file, as the design will not be tested against an API mock or real implementation at this stage ***
# PactFlow compares OpenAPI against any registered consumers
# Visiblity into affected consumers visible via can-i-deploy
on:
push:
branches: ['design-candidate*','swaggerhub*', 'main']
paths:
- 'oas/**'
pull_request:
branches: ['main']
paths:
- 'oas/**'
workflow_dispatch:
env:
oas_file_location: oas/openapi.yaml
application_name: pactflow-example-provider
PACT_BROKER_BASE_URL: https://test.pactflow.io
PACT_BROKER_TOKEN: ${{ secrets.PACTFLOW_TOKEN_FOR_CI_CD_WORKSHOP }}
jobs:
pact-publish-oas-action:
# Remove the following condition to run this on your own fork
if: ${{ github.repository_owner == 'pactflow' }}
# This workflow is disabled by default to allow users to run the Consumer-Driven Contract
# testing workshop without distraction. By removing the condition, this workflow will
# upload an OpenAPI Design candidate showcasing Bi-Directional Contract testing
# working alongside Bi-Directional Contract Testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: get version of OAS
run: |
sudo snap install yq
UNIQUE_VERSION=$(yq '.info.version' ${{ env.oas_file_location }})-${{ github.sha }}-design
echo "version=${UNIQUE_VERSION}" >> $GITHUB_ENV
- name: publishing ${{ env.application_name }} with ${{ env.version }} to PactFlow
uses: pactflow/actions/[email protected]
env:
oas_file: ${{ env.oas_file_location }}
results_file: ${{ env.oas_file_location }}
outputs:
version: ${{ env.version }}
pact-can-i-deploy:
strategy:
matrix:
environment: [test, production]
fail-fast: false
needs: pact-publish-oas-action
runs-on: ubuntu-latest
steps:
- name: can-i-deploy ${{ env.application_name }} to ${{ matrix.environment }}
uses: pactflow/actions/[email protected]
env:
to_environment: ${{ matrix.environment }}
version: ${{ needs.pact-publish-oas-action.outputs.version }}