-
Notifications
You must be signed in to change notification settings - Fork 1.7k
114 lines (107 loc) · 3.95 KB
/
gapic-generator-tests.yml
File metadata and controls
114 lines (107 loc) · 3.95 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
111
112
113
114
name: Gapic Generator Specialized Tests
on:
pull_request:
paths:
- 'packages/gapic-generator/**'
- '.github/workflows/gapic-generator-tests.yml'
push:
branches: [main]
paths:
- 'packages/gapic-generator/**'
concurrency:
group: gapic-gen-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
SHOWCASE_VERSION: 0.35.0
PROTOC_VERSION: 3.20.2
OLDEST_PYTHON: 3.9
LATEST_STABLE_PYTHON: 3.14
PREVIEW_PYTHON_VERSION: 3.14
ALL_PYTHON: "['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']"
jobs:
# Preserve the workaround for env variables in matrix
python_config:
runs-on: ubuntu-latest
outputs:
all_python: ${{ env.ALL_PYTHON }}
oldest_python: ${{ env.OLDEST_PYTHON }}
latest_stable_python: ${{ env.LATEST_STABLE_PYTHON }}
steps:
- run: echo "Initializing config"
showcase-unit:
needs: python_config
strategy:
fail-fast: false
matrix:
python: ${{ fromJSON(needs.python_config.outputs.all_python) }}
variant: ['', _alternative_templates, _mixins, _alternative_templates_mixins, _w_rest_async]
logging_scope: ["", "google"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "${{ matrix.python }}"
- name: Install System Deps & Protoc
run: |
sudo apt-get update && sudo apt-get install -y curl pandoc unzip
sudo mkdir -p /usr/src/protoc/ && sudo chown -R ${USER} /usr/src/
curl --location https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip --output /usr/src/protoc/protoc.zip
cd /usr/src/protoc/ && unzip protoc.zip
sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc
- name: Run Nox
env:
GOOGLE_SDK_PYTHON_LOGGING_SCOPE: ${{ matrix.logging_scope }}
run: |
pip install nox
cd packages/gapic-generator
nox -s showcase_unit${{ matrix.variant }}-${{ matrix.python }}
goldens:
needs: python_config
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.LATEST_STABLE_PYTHON }}
- name: Install System Deps
run: sudo apt-get update && sudo apt-get install -y pandoc
- name: Run Goldens (Lint/Unit)
run: |
pip install nox
cd packages/gapic-generator
for pkg in credentials eventarc logging redis; do
nox -f tests/integration/goldens/$pkg/noxfile.py -s format lint unit-${{ env.LATEST_STABLE_PYTHON }}
done
fragment-snippet:
needs: python_config
strategy:
matrix:
python: ["3.10", "3.14"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
# This fixes the Pandoc error
- name: Install System Deps & Protoc
run: |
sudo apt-get update && sudo apt-get install -y curl pandoc unzip
sudo mkdir -p /usr/src/protoc/ && sudo chown -R ${USER} /usr/src/
curl --location https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip --output /usr/src/protoc/protoc.zip
cd /usr/src/protoc/ && unzip protoc.zip
sudo ln -s /usr/src/protoc/bin/protoc /usr/local/bin/protoc
- name: Run Tests
run: |
pip install nox
cd packages/gapic-generator
# Run fragment for current matrix python
nox -s fragment-${{ matrix.python }}
# Run snippetgen only on the latest stable to avoid the "Python not found" error
if [ "${{ matrix.python }}" == "${{ env.LATEST_STABLE_PYTHON }}" ]; then
nox -s snippetgen
fi