Some CI improvements: updated versions and better reporting #189
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: runner.os != 'Linux' | |
run: mv .dwas/cache/pytest-* .dwas/cache/pytest-${{ matrix.os }} | |
- name: Save coverage files | |
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 | |
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 | |
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: Download generated coverage files | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
pattern: coverage-* | |
path: .dwas/cache | |
- name: Generate coverage report | |
run: dwas --verbose --only coverage | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: ./_artifacts/coverage/coverage.xml | |
fail_ci_if_error: true | |
verbose: true | |
- 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 | |
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 |