Skip to content

Commit

Permalink
Separate sdist build and dist validation job
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Aug 28, 2022
1 parent c93aabc commit 1349c0e
Showing 1 changed file with 26 additions and 19 deletions.
45 changes: 26 additions & 19 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: build
name: Build and test

on: # yamllint disable-line rule:truthy
push:
Expand All @@ -12,26 +12,18 @@ on: # yamllint disable-line rule:truthy

jobs:

build:
build-wheel:
runs-on: ubuntu-latest
outputs:
darker-wheel-path: ${{ steps.get-darker-version.outputs.wheel-path }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
- name: Upgrade pip, install wheel and twine
run: |
# strict dependency resolution added in pip 20.3
python -m pip install --upgrade 'pip>=20.3' wheel twine
- name: Build source distribution
run: python setup.py sdist
- name: Install wheel
run: python -m pip install wheel
- name: Build wheel distribution
run: python setup.py bdist_wheel
- name: Validate distributions
run: twine check dist/*
- name: Upload distributions for test jobs
- name: Upload wheel for other jobs
uses: actions/upload-artifact@v3
with:
name: dist
Expand Down Expand Up @@ -60,13 +52,13 @@ jobs:
python-version: python39
# see https://github.com/cachix/install-nix-action/issues/135
needs:
- build
- build-wheel
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v17
with:
nix_path: nixpkgs=channel:nixos-21.11
- name: Download distributions made by the build job
- name: Download wheel uploaded by the build-wheel job
uses: actions/download-artifact@v3
- name: Run tests in nix-shell
run: |
Expand All @@ -76,7 +68,7 @@ jobs:
--run '
python -m venv venv
source venv/bin/activate
pip install "${{needs.build.outputs.darker-wheel-path}}[test]"
pip install "${{needs.build-wheel.outputs.darker-wheel-path}}[test]"
pytest
' \
./default.nix
Expand Down Expand Up @@ -105,7 +97,7 @@ jobs:
constraints: '--constraint constraints-future.txt'
upgrade: '--upgrade --upgrade-strategy=eager'
needs:
- build
- build-wheel
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -115,13 +107,28 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Download distributions made by the build job
- name: Download wheel uploaded by the build-wheel job
uses: actions/download-artifact@v3
- name: Install Darker and its dependencies from the wheel build earlier
env:
pip_options: ${{ matrix.upgrade }} ${{ matrix.constraints }}
run: pip install ${pip_options}
"${{needs.build.outputs.darker-wheel-path}}[test]"
"${{needs.build-wheel.outputs.darker-wheel-path}}[test]"
- name: Run Pytest
run: |
pytest --darker
build-sdist-validate-dists:
runs-on: ubuntu-latest
needs:
- build-wheel
steps:
- uses: actions/setup-python@v3
- name: Install twine
run: python -m pip install twine
- name: Download wheel uploaded by the build-wheel job
uses: actions/download-artifact@v3
- name: Build source distribution
run: python setup.py sdist
- name: Validate distributions
run: twine check dist/*

0 comments on commit 1349c0e

Please sign in to comment.