Some CI improvements: updated versions and better reporting #198
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: Checks | |
env: | |
DEFAULT_PYTHON: 3.8 | |
PACKAGES_PATH: .dwas/cache/package/ | |
COVERAGE_FILES_PATH: .dwas/cache/pytest-*/reports/coverage | |
JUNIT_REPORT_PATH: _artifacts/junit/ | |
TERM: "xterm-256color" | |
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
# Use the concurrency feature to ensure we don't run redundant workflows | |
# | |
concurrency: | |
group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
session: | |
- black | |
- docformatter | |
- isort | |
- mypy | |
- pylint | |
- unimport | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
cache: pip | |
# FIXME: we should take dwas from pypi once it's published | |
- name: Install dwas | |
run: python -m pip install . | |
- name: ${{ matrix.session }} | |
run: dwas --verbose --only ${{ matrix.session }} | |
package: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
cache: pip | |
# FIXME: we should take dwas from pypi once it's published | |
- name: Install dwas | |
run: python -m pip install . | |
- name: package | |
run: dwas --verbose --only package | |
- name: Save packaged dist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ${{ env.PACKAGES_PATH }}/* | |
retention-days: 7 | |
test: | |
runs-on: ${{ matrix.os }} | |
needs: package | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python: | |
- "3.8" | |
- "3.9" | |
# - "3.10" | |
# - "3.11" | |
# - "3.12" | |
# - "pypy3.8" | |
# include: | |
# - os: macos-latest | |
# python: "3.8" | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: pip | |
# FIXME: we should take dwas from pypi once it's published | |
- name: Install dwas | |
run: python -m pip install . | |
- name: Download packaged dist | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: ${{ env.PACKAGES_PATH }} | |
- name: pytest[${{ matrix.python }}] | |
run: dwas --verbose --only pytest[${{ matrix.python }}] -- --junitxml=${{ env.JUNIT_REPORT_PATH }}/junit-${{ matrix.os}}-${{ matrix.python }}.xml --override-ini junit_suite_name="${{ matrix.os }}-${{ matrix.python }}" ${{ !startsWith(matrix.python, 'pypy') && '--numprocesses 2' || '' }} | |
- name: Move the coverage to another place to avoid conflicts | |
if: always() && runner.os != 'Linux' | |
run: mv .dwas/cache/pytest-* .dwas/cache/pytest-${{ matrix.os }} | |
- name: Save coverage files | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-files-pytest-${{ matrix.os }}-${{ matrix.python }} | |
path: ${{ env.COVERAGE_FILES_PATH }} | |
retention-days: 7 | |
- name: Save junit report | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: junit-${{ matrix.os }}-${{ matrix.python }} | |
path: ${{ env.JUNIT_REPORT_PATH }}/junit-${{ matrix.os }}-${{ matrix.python }}.xml | |
retention-days: 7 | |
coverage: | |
runs-on: ubuntu-latest | |
needs: test | |
if: always() | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
cache: pip | |
- name: Install coverage | |
run: python -m pip install coverage[toml] | |
- name: Download generated coverage files | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
pattern: coverage-* | |
path: reports/ | |
- name: Combine coverage files | |
run: coverage combine reports/*/*/coverage | |
- name: Generate coverage summary | |
run: coverage report --format=markdown --show-missing | tee "${GITHUB_STEP_SUMMARY}" | |
- name: Generate xml coverage | |
run: coverage xml -o _artifacts/coverage.xml | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./_artifacts/coverage.xml | |
fail_ci_if_error: true | |
verbose: true | |
- name: Generate html coverage | |
run: coverage html --directory _artifacts/coverage/html | |
- name: Save coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage [html] | |
path: _artifacts/coverage/html | |
retention-days: 7 | |
report: | |
runs-on: ubuntu-latest | |
needs: test | |
if: always() | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
- name: Install package dependencies | |
run: pip install tabulate | |
- name: Download junit reports | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
pattern: junit-* | |
path: reports/ | |
- name: Generate summary | |
run: python .github/scripts/summary.py reports/*.xml > "${GITHUB_STEP_SUMMARY}" | |
twine: | |
runs-on: ubuntu-latest | |
needs: package | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON }} | |
cache: pip | |
- name: Download packaged dist | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: ${{ env.PACKAGES_PATH }} | |
# FIXME: we should take dwas from pypi once it's published | |
- name: Install dwas | |
run: python -m pip install . | |
- name: Validate packages with twine | |
run: dwas --verbose --only twine:check |