mirror of
https://github.com/theupdateframework/python-tuf
synced 2026-05-24 10:08:28 +00:00
Dependabot pushes to main repository and ends up triggering two builds every time (one for PR, one for push): limit the rule for build-on-push to apply to develop branch only. If release branches are used later on they should be added to list here. Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
107 lines
3.7 KiB
YAML
107 lines
3.7 KiB
YAML
name: Run TUF tests and linter
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- develop
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
# Run regular TUF tests on each OS/Python combination, plus special tests
|
|
# (sslib master) and linters on Linux/Python3.x only.
|
|
matrix:
|
|
python-version: [2.7, 3.6, 3.7, 3.8, 3.9]
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
toxenv: [py]
|
|
include:
|
|
- python-version: 3.x
|
|
os: ubuntu-latest
|
|
toxenv: with-sslib-master
|
|
experimental: true
|
|
# TODO: Change to 3.x once pylint fully supports Python 3.9
|
|
- python-version: 3.8
|
|
os: ubuntu-latest
|
|
toxenv: lint
|
|
|
|
env:
|
|
# Set TOXENV env var to tell tox which testenv (see tox.ini) to use
|
|
# NOTE: The Python 2.7 runner has two Python versions on the path (see
|
|
# setup-python below), so we tell tox explicitly to use the 'py27'
|
|
# testenv. For all other runners the toxenv configured above suffices.
|
|
TOXENV: ${{ matrix.python-version == '2.7' && 'py27' || matrix.toxenv }}
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
- name: Checkout TUF
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Set up service Python 3.x (on 2.7 only)
|
|
uses: actions/setup-python@v2
|
|
if: ${{ matrix.python-version == 2.7 }}
|
|
with:
|
|
python-version: 3.x
|
|
|
|
- name: Find pip cache dir
|
|
id: pip-cache
|
|
run: echo "::set-output name=dir::$(pip cache dir)"
|
|
|
|
- name: pip cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
# Use the os dependent pip cache directory found above
|
|
path: ${{ steps.pip-cache.outputs.dir }}
|
|
# A match with 'key' counts as cache hit
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }}
|
|
# A match with 'restore-keys' is used as fallback
|
|
restore-keys: ${{ runner.os }}-pip-
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install --upgrade tox coveralls
|
|
|
|
- name: Run tox (${{ env.TOXENV }})
|
|
# See TOXENV environment variable for the testenv to be executed here
|
|
run: tox
|
|
|
|
- name: Publish on coveralls.io
|
|
# TODO: Maybe make 'lint' a separate job instead of case handling here
|
|
if: ${{ env.TOXENV != 'lint' }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
COVERALLS_FLAG_NAME: ${{ runner.os }} / Python ${{ matrix.python-version }} / ${{ env.TOXENV }}
|
|
COVERALLS_PARALLEL: true
|
|
# Use cp workaround to publish coverage reports with relative paths
|
|
# FIXME: Consider refactoring the tests to not require the test
|
|
# aggregation script being invoked from the `tests` directory, so
|
|
# that `.coverage` is written to and .coveragrc can also reside in
|
|
# the project root directory as is the convention.
|
|
run: |
|
|
cp tests/.coverage .
|
|
coveralls --service=github --rcfile=tests/.coveragerc
|
|
|
|
coveralls-fin:
|
|
# Always run when all 'build' jobs have finished even if they failed
|
|
# TODO: Replace always() with a 'at least one job succeeded' expression
|
|
if: always()
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
container: python:3-slim
|
|
steps:
|
|
- name: Finalize publishing on coveralls.io
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install --upgrade coveralls
|
|
coveralls --finish
|