-
Notifications
You must be signed in to change notification settings - Fork 2
155 lines (145 loc) · 5.41 KB
/
github-actions.yml
File metadata and controls
155 lines (145 loc) · 5.41 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
144
145
146
147
148
149
150
151
152
153
154
155
name: build
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
env:
CACHE_VERSION: 1
PRE_COMMIT_CACHE: ~/.cache/pre-commit
jobs:
deployv:
name: docker vauxoo light image (LINT_COMPATIBILITY_VERSION=${{ matrix.lint_compatibility_version }})
runs-on: ubuntu-latest
container:
image: quay.io/vauxoo/dockerv:latest
options: --user root
strategy:
fail-fast: false
matrix:
lint_compatibility_version:
- "__UNSET__"
- "0.0.0.0.0.0.0.0"
- "10.10.10.10.10.10.10.10"
- "20.20.20.20.20.20.20.20"
- "30.30.30.30.30.30.30.30"
env:
PIP_CACHE_DIR: "/root/.cache/pip"
PRE_COMMIT_HOME: "/root/.cache/pre-commit"
steps:
- uses: actions/checkout@v4
- name: Upgrade pre-commit-vauxoo to the latest version (w/o update dependencies if not needed)
run: >-
pip3 install --ignore-installed -U . &&
pip3 install --force-reinstall --no-deps . &&
git config --global --add safe.directory '*'
- name: Run pre-commit-vauxoo (unset LINT_COMPATIBILITY_VERSION)
if: ${{ matrix.lint_compatibility_version == '__UNSET__' }}
run: pre-commit-vauxoo
- name: Run pre-commit-vauxoo (with LINT_COMPATIBILITY_VERSION)
if: ${{ matrix.lint_compatibility_version != '__UNSET__' }}
env:
LINT_COMPATIBILITY_VERSION: ${{ matrix.lint_compatibility_version }}
run: pre-commit-vauxoo
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
os: [ubuntu-latest, windows-latest, macos-latest]
tox_env: ['py-multi']
include:
- python: '3.13'
os: ubuntu-latest
tox_env: 'lint'
- python: '3.13'
os: ubuntu-latest
tox_env: 'docs'
- python: '3.13'
os: ubuntu-latest
tox_env: 'build'
exclude:
# macos-14 AKA macos-latest has switched to being an ARM runner, only supporting newer versions of Python
# https://github.com/actions/setup-python/issues/825#issuecomment-2096792396
- python: '3.10'
os: macos-latest
steps:
- name: Set git to not change EoL
if: runner.os == 'Windows'
run: |
git config --global core.autocrlf false
- name: Cache pre-commit packages
id: cache-pre-commit
uses: actions/cache@v4
with:
path: ${{ env.PRE_COMMIT_CACHE }}
key: ${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python }}-pre-commit
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
architecture: 'x64'
cache: 'pip'
- name: Install system dependencies (Linux only)
if: runner.os == 'Linux'
run: |
sudo apt-get update -qqq
sudo apt-get install -y libxml2-dev libxslt1-dev zlib1g-dev
- name: install dependencies
run: |
python -mpip install --progress-bar=off -r test-requirements.txt
# virtualenv --version
pip --version
# tox --version
pip list --format=freeze
- name: install apk packages
if: runner.os == 'Linux'
run: |
sudo apt update -qq
sudo rm -rf /var/lib/man-db/auto-update # Avoid unnecessary time-consuming "Processing triggers for man-db" after using "apt install"
sudo apt install -y libecpg-dev # Required for vx-check-deactivate hook
- name: Test == windows
if: runner.os == 'Windows'
env:
TOXPYTHON: '${{ matrix.toxpython }}'
run: |
[System.Environment]::SetEnvironmentVariable('PATH',$env:Path + ";" + $env:PGBIN)
ecpg --version
tox -e ${{ matrix.tox_env }} -v
- name: Test != Windows
if: runner.os != 'Windows'
env:
TOXPYTHON: '${{ matrix.toxpython }}'
run: |
tox -e ${{ matrix.tox_env }} -v
# TODO: Publish package only for signed tags
- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') && contains(matrix.tox_env, 'build')
run: |
ls -lah dist/*
python -m twine upload --verbose -u __token__ -p ${{ secrets.PYPI_API_TOKEN }} --repository-url https://upload.pypi.org/legacy/ dist/*
sleep 300
curl -X POST -F token=${{ secrets.TRIGGER_TOKEN_DOCKERV }} -F ref=master https://git.vauxoo.com/api/v4/projects/443/trigger/pipeline
# TODO: Add GITHUB_RUN_ID.GITHUB_RUN_ATTEMPT.GITHUB_RUN_NUMBER to bumpversion to avoid duplicating upload versions or even the git sha
# For now, feel free to uncomment this line of code to test things related to upload to pypi (test)
# - name: TestPyPI publish package
# if: runner.os == 'Linux' && startsWith(matrix.tox_env, 'py39-cover')
# run: >-
# python -m twine upload --verbose -u __token__ -p ${{ secrets.PYPI_TEST_API_TOKEN }} \
# --repository-url https://test.pypi.org/legacy/ dist/* || true
- name: codecov
if: startsWith(matrix.tox_env, 'py') # only coveralls in python tests
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: false # TODO: Set true after fix token for win&macosx
verbose: true