-
-
Notifications
You must be signed in to change notification settings - Fork 35
143 lines (133 loc) · 5.05 KB
/
pythonpackage.yml
File metadata and controls
143 lines (133 loc) · 5.05 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
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
name: Python package
on:
# The following config trigger the workflow upon commits but not tags creation
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request:
# Ensure this workflow's jobs can be triggered from other workflows, e.g. publish
workflow_call:
jobs:
py36:
runs-on: ubuntu-latest
container: python:3.6
steps:
- uses: actions/checkout@v4
- run: python --version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[tests]
- name: Test with pytest
run: |
pytest -v -n auto --cov=$REPO_NAME --cov-report=xml --junitxml=junit/test-results-3.6.xml
env:
# Use custom token if available, otherwise fall back to GITHUB_TOKEN (for Dependabot PRs)
LASTVERSION_GITHUB_API_TOKEN: ${{ secrets.LASTVERSION_GITHUB_API_TOKEN || github.token }}
- name: Update .spec files
run: |
# ensure changelog is generated
echo "%packager Dick Solomon <info@example.com>" >> ~/.rpmmacros
cd tests
lastversion brotli.spec
lastversion nginx-module-immutable.spec
if lastversion libmozjpeg.spec; then
exit 1
fi
rm -rf libmozjpeg.spec
env:
# Use custom token if available, otherwise fall back to GITHUB_TOKEN (for Dependabot PRs)
LASTVERSION_GITHUB_API_TOKEN: ${{ secrets.LASTVERSION_GITHUB_API_TOKEN || github.token }}
- name: 'Upload brotli.spec artifact'
uses: actions/upload-artifact@v4
with:
name: brotli.spec
path: tests/brotli.spec
- name: 'Upload nginx-module-immutable.spec artifact'
uses: actions/upload-artifact@v4
with:
name: nginx-module-immutable.spec
path: tests/nginx-module-immutable.spec
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 7
matrix:
python-version: ["3.9", "3.13"]
steps:
- uses: actions/checkout@v3
- name: Extract repository name which is also our primary package name
run: echo "REPO_NAME=$(basename $GITHUB_REPOSITORY)" >> $GITHUB_ENV
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies will speed up subsequent runs
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[tests]
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
# with:
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow
# limit-access-to-actor: true
# ## limits ssh access and adds the ssh public keys of the listed GitHub users
# limit-access-to-users: dvershinin
- name: Test with pytest
run: |
pytest -v -n auto --cov=$REPO_NAME --cov-report=xml --junitxml=junit/test-results-${{ matrix.python-version }}.xml
env:
# Use custom token if available, otherwise fall back to GITHUB_TOKEN (for Dependabot PRs)
LASTVERSION_GITHUB_API_TOKEN: ${{ secrets.LASTVERSION_GITHUB_API_TOKEN || github.token }}
- name: Upload pytest test results
uses: actions/upload-artifact@v4
with:
name: pytest-results-${{ matrix.python-version }}
path: junit/test-results-${{ matrix.python-version }}.xml
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
- name: Upload coverage to Codacy
# Skip for Dependabot PRs which don't have access to secrets
if: github.actor != 'dependabot[bot]'
run: |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
build-brotli-rpm:
needs: py36
runs-on: ubuntu-latest
container: getpagespeed/rpmbuilder:centos-8
steps:
- name: Download brotli.spec artifact
uses: actions/download-artifact@v4
with:
name: brotli.spec
- name: Build updated spec
run: |
mkdir -p /github/home/rpmbuild/{SOURCES,SPECS}/
mv *.spec /sources/
build
build-nginx-module-immutable-rpm:
needs: py36
runs-on: ubuntu-latest
container: getpagespeed/rpmbuilder:centos-8
steps:
- name: Download nginx-module-immutable.spec artifact
uses: actions/download-artifact@v4
with:
name: nginx-module-immutable.spec
- name: Build updated spec
run: |
mkdir -p /github/home/rpmbuild/{SOURCES,SPECS}/
mv *.spec /sources/
yum -y install nginx-devel
build