Skip to content

Update application-api refs (#476) #120

Update application-api refs (#476)

Update application-api refs (#476) #120

name: Publish Pact results
on:
push:
branches: [ main ]
jobs:
pact:
name: Run Pact tests and push verification results
runs-on: ubuntu-latest
env:
OPERATOR_SDK_VERSION: v1.14.0
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.19
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache Operator SDK ${{ env.OPERATOR_SDK_VERSION }}
uses: actions/cache@v2
id: cache-operator-sdk
with:
path: ~/cache
key: operator-sdk-${{ env.OPERATOR_SDK_VERSION }}
- name: Download Operator SDK ${{ env.OPERATOR_SDK_VERSION }}
if: steps.cache-operator-sdk.outputs.cache-hit != 'true'
run: |
mkdir -p ~/cache
wget https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk_linux_amd64 -O ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} > /dev/null -O ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} > /dev/null
chmod +x ~/cache/operator-sdk-${OPERATOR_SDK_VERSION}
- name: Install Operator SDK ${{ env.OPERATOR_SDK_VERSION }}
run: |
mkdir -p ~/bin
cp ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} ~/bin/operator-sdk
echo "$HOME/bin" >> $GITHUB_PATH
- name: Cache go modules
id: cache-mod
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Download dependencies
run: go mod download
if: steps.cache-mod.outputs.cache-hit != 'true'
- name: Test Pact contracts
shell: bash
env:
PACT_BROKER_PASSWORD: ${{ secrets.PACT_BROKER_PASSWORD }}
PACT_BROKER_USERNAME: ${{ secrets.PACT_BROKER_USERNAME }}
PROVIDER_BRANCH: "main"
run: |
go get github.com/pact-foundation/pact-go/[email protected]
go install github.com/pact-foundation/pact-go/[email protected]
sudo /home/runner/go/bin/pact-go -l DEBUG install
echo "Running Pact tests from the \"$(git branch --show-current)\" brach."
# Run Pact tests and publish results. Required variables to be set:
# COMMIT_SHA sets the version
# PROVIDER_BRANCH sets the branch tag
# PACT_BROKER_PASSWORD login info with push rights
# PACT_BROKER_USERNAME login info with push rights
export COMMIT_SHA=$(git rev-parse --short HEAD)
make pact