-
Notifications
You must be signed in to change notification settings - Fork 9
129 lines (100 loc) · 3.81 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
defaults:
run:
shell: "bash"
name: "CI"
on:
push:
branches: ["main"]
tags: ["v*"]
pull_request:
branches: ["main"]
concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}"
cancel-in-progress: true
env:
PYTHONUNBUFFERED: "1"
jobs:
dev:
name: "Verify package is installed well"
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
runs-on: "${{ matrix.os }}"
steps:
- uses: "actions/[email protected]"
- id: "python_and_poetry"
uses: "./.github/actions/install_python_and_poetry"
with:
cache-key-suffix: "-main"
python-version-file: ".python-version"
- name: "Install package"
run: "poetry install --only main"
- name: "Check that the poetry.lock file corresponds to the current version of pyproject.toml"
if: "${{ matrix.os == 'ubuntu-latest' }}"
run: "poetry lock --check"
- name: "Import package"
run: "poetry run python3 -c 'import rororo; from rororo import aio, timedelta;'"
docs:
uses: "./.github/workflows/ci_verify_docs_build.yml"
test:
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
include:
- cache-key-suffix: "-main-dev"
- python-version: "3.11"
cache-key-suffix: "-main-dev-test"
dev: "true"
name: "Python ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
services:
redis:
image: "redis:6.0.7-alpine"
ports:
- "6379/tcp"
options: "--entrypoint redis-server"
steps:
- uses: "actions/[email protected]"
- name: "Install system packages"
run: "sudo apt-get update -yqq && sudo apt-get install -yq locales-all"
- id: "python_and_poetry"
uses: "./.github/actions/install_python_and_poetry"
with:
cache-key-suffix: "${{ matrix.cache-key-suffix }}"
python-version: "${{ matrix.python-version }}"
- if: "${{ matrix.dev == 'true' }}"
uses: "./.github/actions/run_pre_commit"
with:
python-version: "${{ steps.python_and_poetry.outputs.python-version }}"
- name: "Validate OpenAPI schemas"
if: "${{ matrix.dev == 'true' }}"
run: |
set -euo pipefail
poetry run python3 -m openapi_spec_validator examples/hobotnica/src/hobotnica/openapi.yaml
poetry run python3 -m openapi_spec_validator examples/petstore/src/petstore/petstore-expanded.yaml
poetry run python3 -m openapi_spec_validator examples/simulations/src/simulations/openapi.yaml
poetry run python3 -m openapi_spec_validator examples/todobackend/src/todobackend/openapi.yaml
poetry run python3 -m openapi_spec_validator tests/rororo/openapi.json
poetry run python3 -m openapi_spec_validator tests/rororo/openapi.yaml
- uses: "./.github/actions/run_tox"
env:
LEVEL: "test"
PYTHONPATH: "examples/hobotnica/src:examples/petstore/src:examples/simulations/src:examples/todobackend/src:examples/vc-api/src"
REDIS_URL: "redis://localhost:${{ job.services.redis.ports[6379] }}/0"
with:
python-path: "${{ steps.python_and_poetry.outputs.python-path }}"
python-version: "${{ steps.python_and_poetry.outputs.python-version }}"
use-coveralls: "${{ matrix.dev }}"
coveralls-token: "${{ secrets.GITHUB_TOKEN }}"
package:
needs: ["test"]
uses: "./.github/workflows/ci_package.yml"
secrets:
pypi-user: "${{ secrets.PYPI_USERNAME }}"
pypi-password: "${{ secrets.PYPI_PASSWORD }}"
release:
needs: ["package"]
if: "${{ startsWith(github.ref, 'refs/tags/') }}"
uses: "./.github/workflows/ci_release.yml"
secrets:
release-token: "${{ secrets.GITHUB_TOKEN }}"