Skip to content

Commit

Permalink
Making tests depend on collate
Browse files Browse the repository at this point in the history
  • Loading branch information
djpugh committed May 1, 2023
1 parent e3747ad commit 9eafaff
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 46 deletions.
77 changes: 41 additions & 36 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,44 @@ jobs:
- name: Lint
run: tox -e lint

collate-packages:
name: Collate Wheels
runs-on: windows-latest
needs:
- changes
if: >
(needs.changes.outputs.config == 'true' || needs.changes.outputs.workflows == 'true') ||
(github.event_name == 'pull_request' && contains(github.base_ref, 'main')) ||
(github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || contains(github.ref, 'main'))) ||
(github.event_name == 'release')
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Populate platform wheels
run: tox -e populate -- --target-dir ./wheels

- name: Store collated wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: |
./wheels/*
test:
name: Test Python ${{ matrix.py }} - ${{ matrix.os }} - ${{matrix.tox_version}}
runs-on: ${{ matrix.os }}-latest
needs:
- changes
- collate-packages
if: >
(needs.changes.outputs.src || needs.changes.outputs.tests || needs.changes.outputs.config || needs.changes.outputs.workflows) ||
(github.event_name == 'pull_request' ) ||
Expand Down Expand Up @@ -168,8 +201,12 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -U tox setuptools
- name: Populate platform wheels
run: tox -e populate -- --py ${{ matrix.py }} --platform ${{ matrix.os }}
- name: Download collated wheels
uses: actions/download-artifact@v3
with:
path: wheels
- shell: bash
run: cp -u wheels/*.whl src/azure_devops_artifacts_helpers/wheels/
- name: Setup Test Suite
run: tox -e test-${{ matrix.tox_version }} -vv --notest
- name: Run Test Suite
Expand Down Expand Up @@ -273,38 +310,6 @@ jobs:
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

collate-packages:
name: Collate Wheels
runs-on: windows-latest
needs:
- changes
if: >
(needs.changes.outputs.config == 'true' || needs.changes.outputs.workflows == 'true') ||
(github.event_name == 'pull_request' && contains(github.base_ref, 'main')) ||
(github.event_name == 'push' && (startsWith(github.ref, 'refs/tags') || contains(github.ref, 'main'))) ||
(github.event_name == 'release')
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Populate platform wheels
run: tox -e populate -- --target-dir ./wheels

- name: Store collated wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: |
./wheels/*
build:
name: Build Package
runs-on: windows-latest
Expand Down Expand Up @@ -337,7 +342,7 @@ jobs:
path: wheels

- shell: bash
run: cp -u wheels/*/*.whl src/azure_devops_artifacts_helpers/wheels/
run: cp -u wheels/*.whl src/azure_devops_artifacts_helpers/wheels/

- name: Build azure_devops_artifacts_helpers
run: tox -e build -vvv
Expand Down Expand Up @@ -375,7 +380,7 @@ jobs:
path: wheels

- shell: bash
run: cp -u wheels/*/*.whl src/azure_devops_artifacts_helpers/wheels/
run: cp -u wheels/*.whl src/azure_devops_artifacts_helpers/wheels/

- name: Build docs
run: tox -e docs
Expand Down
21 changes: 11 additions & 10 deletions tools/populate-wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,20 @@ def populate_wheels(index_url: str = DOWNLOAD_INDEX_URL, python_versions: List[s
dependencies = pyproject_toml['project']['requires-python']
if not python_versions:
# This works for same minor version only - assuming no major version change
min_version, max_version = required_python_versions.split(',')
_min_version, _max_version = required_python_versions.split(',')
# Version
if min_version.startswith('>='):
min_version = Version(min_version.lstrip('>='))
elif min_version.startswith('>'):
_v = Version(min_version.lstrip('>'))
if _min_version.startswith('>='):
min_version = Version(_min_version.lstrip('>='))
elif _min_version.startswith('>'):
_v = Version(_min_version.lstrip('>'))
min_version = Version(f'{_v.major}.{_v.minor+1}')
if max_version.startswith('<='):
max_version = Version(max_version.lstrip('<='))
elif max_version.startswith('<'):
_v = Version(max_version.lstrip('<'))
if _max_version.startswith('<='):
max_version = Version(_max_version.lstrip('<='))
elif _max_version.startswith('<'):
_v = Version(_max_version.lstrip('<'))
max_version = Version(f'{_v.major}.{_v.minor-1}')
python_versions = [f'{min_version.major}.{minor}' for minor in range(min_version.minor, max_version.minor)]
python_versions = [f'{min_version.major}.{minor}' for minor in range(min_version.minor, max_version.minor+1)]
print(f'Using versions: {python_versions} from {_min_version}:{_max_version}')
if not platforms:
platforms = ['win32', 'darwin', 'linux']
processed_platforms = []
Expand Down

0 comments on commit 9eafaff

Please sign in to comment.