-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (60 loc) · 2.23 KB
/
build.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
# A regular deployment pipeline workflow that runs on every commit.
# It builds and tests the application, including running Pact contract tests.
name: Build
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
GIT_COMMIT: ${{ github.sha }}
PACT_BROKER_BASE_URL: ${{ secrets.PACT_BROKER_BASE_URL }}
PACT_BROKER_TOKEN: ${{ secrets.PACT_BROKER_TOKEN }}
PACT_PUBLISH_VERIFICATION_RESULTS: true
POETRY_VIRTUALENVS_CREATE: false
PYTHONPATH: src
strategy:
max-parallel: 1
matrix:
python-version: ['3.11']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry cache for Python dependencies
uses: actions/cache@v3
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-
- name: Install Pact Broker CLI
run: |
curl -fsSL https://raw.githubusercontent.com/pact-foundation/pact-ruby-standalone/master/install.sh | PACT_CLI_VERSION=v2.0.10 bash
echo "$HOME/pact/bin/pact-broker" >> $GITHUB_PATH
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: '1.5.5'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | POETRY_HOME="$HOME/.poetry" python - --yes
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Test Poetry installation
run: poetry --version
- name: Install dependencies
run: |
poetry install --no-interaction --with dev --all-extras
poetry show --tree
# - name: Run commit hooks
# run: SKIP=test poetry run hooks
- name: Run Pact contract tests
run: pytest -m "(consumer or provider) and pactflow"
- name: Publish Pacts to PactFlow
run: pact-broker publish --auto-detect-version-properties pacts