Update CI/RTD #670
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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/checkout@v3 | |
- 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.7', '3.8', '3.9', '3.10', '3.11'] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
tox_env: ['py'] | |
include: | |
- python: '3.10' | |
os: ubuntu-latest | |
tox_env: 'lint' | |
- python: '3.10' | |
os: ubuntu-latest | |
tox_env: 'docs' | |
- python: '3.10' | |
os: ubuntu-latest | |
tox_env: 'build' | |
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@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: ${{ runner.os }}-py${{ matrix.python }}-pre-commit | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
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 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@v3 | |
with: | |
fail_ci_if_error: false # TODO: Set true after fix token for win&macosx | |
verbose: true |