-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (128 loc) · 4.6 KB
/
github-actions.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
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:
runs-on: ubuntu-latest
container:
image: quay.io/vauxoo/dockerv:latest
options: --user root
name: docker vauxoo light image
env:
PIP_CACHE_DIR: "/root/.cache/pip"
PRE_COMMIT_HOME: "/root/.cache/pre-commit"
steps:
- uses: actions/[email protected]
- 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 .
- name: Run pre-commit-vauxoo
run: pre-commit-vauxoo
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest, macos-13, macos-latest]
tox_env: ['py']
include:
- python: '3.12'
os: ubuntu-latest
tox_env: 'lint'
- python: '3.12'
os: ubuntu-latest
tox_env: 'docs'
- python: '3.12'
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.8'
os: macos-latest
- python: '3.9'
os: macos-latest
- 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/[email protected]
with:
fetch-depth: 0
- uses: actions/[email protected]
with:
python-version: ${{ matrix.python }}
architecture: 'x64'
cache: 'pip'
- 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