-
Notifications
You must be signed in to change notification settings - Fork 71
168 lines (158 loc) · 6.46 KB
/
ci.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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Continuous Integration
on:
pull_request:
push:
branches:
- main
- "releases/*"
jobs:
# Build and test the project
build-lint-test:
strategy:
fail-fast: false
matrix:
python: ["3.8", "3.12"]
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
include:
- os: ubuntu-latest
python: "3.12"
docsTarget: true
cloudTestTarget: true
- os: ubuntu-latest
python: "3.8"
protoCheckTarget: true
- os: ubuntu-arm
runsOn: ubuntu-24.04-arm64-2-core
- os: macos-intel
runsOn: macos-12
- os: macos-arm
runsOn: macos-14
# macOS ARM 3.8 does not have an available Python build at
# https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json.
# See https://github.com/actions/setup-python/issues/808 and
# https://github.com/actions/python-versions/pull/259.
exclude:
- os: macos-arm
python: "3.8"
runs-on: ${{ matrix.runsOn || matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: temporalio/bridge -> target
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: arduino/setup-protoc@v3
with:
# TODO(cretz): Can upgrade proto when https://github.com/arduino/setup-protoc/issues/99 fixed
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
# Using fixed Poetry version until
# https://github.com/python-poetry/poetry/issues/7611 and
# https://github.com/python-poetry/poetry/pull/7694 are fixed
- run: python -m pip install --upgrade wheel "poetry==1.3.2" poethepoet
- run: poetry install --no-root --all-extras
- run: poe lint
- run: poe build-develop
- run: poe test -s --alluredir allure-results-${{ matrix.python }}-${{ matrix.os }} -o log_cli_level=DEBUG
- name: "Allure: upload artifact"
uses: actions/upload-artifact@master
if: always()
with:
# TODO: handle matrix build structure with allure
name: allure-results-${{ matrix.python }}-${{ matrix.os }}
path: allure-results-${{ matrix.python }}-${{ matrix.os }}
retention-days: 30
# Time skipping doesn't yet support ARM
- if: ${{ !endsWith(matrix.os, '-arm') }}
run: poe test -s -o log_cli_level=DEBUG --workflow-environment time-skipping
# Check cloud if proper target and not on fork
- if: ${{ matrix.cloudTestTarget && (github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/sdk-python') }}
run: poe test -s -o log_cli_level=DEBUG -k test_cloud_client
env:
TEMPORAL_CLIENT_CLOUD_API_KEY: ${{ secrets.TEMPORAL_CLIENT_CLOUD_API_KEY }}
TEMPORAL_CLIENT_CLOUD_API_VERSION: 2024-05-13-00
TEMPORAL_CLIENT_CLOUD_NAMESPACE: sdk-ci.a2dd6
# Confirm protos are already generated properly with older protobuf
# library and run test with that older version. We must downgrade protobuf
# so we can generate 3.x and 4.x compatible API. We have to use older
# Python to run this check because the grpcio-tools version we use
# is <= 3.10.
- name: Check generated protos and test protobuf 3.x
if: ${{ matrix.protoCheckTarget }}
env:
TEMPORAL_TEST_PROTO3: 1
run: |
poetry add "protobuf<4"
poe gen-protos
poe format
[[ -z $(git status --porcelain temporalio) ]] || (git diff temporalio; echo "Protos changed"; exit 1)
poe test -s -o log_cli_level=DEBUG
# Do docs stuff (only on one host)
- name: Build API docs
if: ${{ matrix.docsTarget }}
run: poe gen-docs
- name: Deploy prod API docs
if: ${{ github.ref == 'refs/heads/main' && matrix.docsTarget }}
run: npx vercel deploy build/apidocs -t ${{ secrets.VERCEL_TOKEN }} --name python --scope temporal --prod --yes
# Confirm README ToC is generated properly
- uses: actions/setup-node@v4
- name: Check generated README ToC
if: ${{ matrix.docsTarget }}
run: |
npx doctoc README.md
[[ -z $(git status --porcelain README.md) ]] || (git diff README.md; echo "README changed"; exit 1)
# Runs the sdk features repo tests with this repo's current SDK code
features-tests:
uses: temporalio/features/.github/workflows/python.yaml@main
with:
python-repo-path: ${{github.event.pull_request.head.repo.full_name}}
version: ${{github.event.pull_request.head.ref}}
version-is-repo-ref: true
features-repo-ref: python-update-updates
# https://allurereport.org/docs/integrations-github/
# https://github.com/simple-elf/allure-report-action/issues/28#issuecomment-1139332329
create-allure-report:
name: "Allure: load previous history, create report, and publish"
needs: build-lint-test
if: always()
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.12"]
os: [ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest]
exclude:
- os: macos-arm
python: "3.8"
steps:
- name: "Allure: Download Artifacts"
uses: actions/download-artifact@v3
id: download
with:
path: allure-results-${{ matrix.python }}-${{ matrix.os }}
name: allure-results
- name: "Allure: load test report history"
uses: actions/checkout@v4
if: always()
continue-on-error: true
with:
ref: gh-pages
path: allure-report-data-${{ matrix.python }}-${{ matrix.os }}
- name: "Allure: build test report"
uses: simple-elf/[email protected]
if: always()
with:
gh_pages: allure-report-data-${{ matrix.python }}-${{ matrix.os }}
allure_results: allure-results
allure_history: allure-history-${{ matrix.python }}-${{ matrix.os }}
- name: "Allure: publish test report"
uses: peaceiris/actions-gh-pages@v4
if: always()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: allure-history-${{ matrix.python }}-${{ matrix.os }}