pytest-html/.github/workflows/actions.yml

232 lines
6.1 KiB
YAML

name: gh
on:
create: # is used for publishing to PyPI and TestPyPI
tags: # any tag regardless of its name, no branches
push: # only publishes pushes to the main branch to TestPyPI
branches: # any maintenance branch but not tag
# avoid generic ** as it duplicates builds from temporary branches
- "master"
- "stable/**"
tags-ignore:
- >-
**
pull_request:
schedule:
- cron: 1 0 * * * # Run daily at 0:01 UTC
jobs:
build_docs:
name: Build Docs
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install tox
run: |
python -m pip install --upgrade tox
- name: Build docs with tox
run: |
python -m tox -e docs
build_python:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-18.04
name: py36-ubuntu
python-version: 3.6
- os: windows-latest
name: py36-windows
python-version: 3.6
- os: macOS-latest
name: py36-mac
python-version: 3.6
- os: ubuntu-18.04
name: py37-ubuntu
python-version: 3.7
- os: windows-latest
name: py37-windows
python-version: 3.7
- os: macOS-latest
name: py37-mac
python-version: 3.7
- os: ubuntu-18.04
name: py38-ubuntu
python-version: 3.8
- os: windows-latest
name: py38-windows
python-version: 3.8
- os: macOS-latest
name: py38-mac
python-version: 3.8
- os: ubuntu-18.04
name: py39-ubuntu
python-version: 3.9
- os: windows-latest
name: py39-windows
python-version: 3.9
- os: macOS-latest
name: py39-mac
python-version: 3.9
- os: ubuntu-18.04
name: pypy3-ubuntu
python-version: pypy3
- os: windows-latest
name: pypy3-windows
python-version: pypy3
- os: macOS-latest
name: pypy3-mac
python-version: pypy3
- os: ubuntu-18.04
name: devel-ubuntu
python-version: 3.8
steps:
- name: Set Newline Behavior
run : |
git config --global core.autocrlf false
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix['python-version'] }}
- name: Install tox
run: |
python -m pip install --upgrade tox
- name: Get Tox Environment Name From Matrix Name
uses: rishabhgupta/split-by@v1
id: split-matrix-name
with:
string: '${{ matrix.name }}'
split-by: '-'
- name: Test with tox
run: |
python -m tox -e ${{ steps.split-matrix-name.outputs._0}}-cov
- name: Upload coverage to codecov
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: true
file: ./coverage.xml
flags: tests
name: ${{ matrix.py }} - ${{ matrix.os }}
verbose: true
build_javascript:
name: grunt
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install Dependencies
run: |
npm install
- name: QUnit Tests
run: |
npm test
env:
CI: true
linting:
name: linting
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install tox
run: |
python -m pip install --upgrade tox
- name: Lint with tox
run: |
python -m tox -e linting
publish:
name: Publish to PyPI registry
needs:
- build_python
- build_javascript
runs-on: ubuntu-latest
env:
PY_COLORS: 1
TOXENV: packaging
steps:
- name: Switch to using Python 3.6 by default
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install tox
run: python -m pip install --user tox
- name: Check out src from Git
uses: actions/checkout@v2
with:
# Get shallow Git history (default) for tag creation events
# but have a complete clone for any other workflows.
# Both options fetch tags but since we're going to remove
# one from HEAD in non-create-tag workflows, we need full
# history for them.
fetch-depth: >-
${{
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
) &&
1 || 0
}}
- name: Drop Git tags from HEAD for non-tag-create events
if: >-
github.event_name != 'create' ||
github.event.ref_type != 'tag'
run: >-
git tag --points-at HEAD
|
xargs git tag --delete
- name: Build dists
run: python -m tox
- name: Publish to test.pypi.org
if: >-
(
github.event_name == 'push' &&
github.ref == format(
'refs/heads/{0}', github.event.repository.default_branch
)
) ||
(
github.event_name == 'create' &&
github.event.ref_type == 'tag'
)
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to pypi.org
if: >- # "create" workflows run separately from "push" & "pull_request"
github.event_name == 'create' &&
github.event.ref_type == 'tag'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}