Skip to content

Commit

Permalink
Fix skipping packages in test-n-publish
Browse files Browse the repository at this point in the history
  • Loading branch information
soininen committed Mar 28, 2024
1 parent a573dd1 commit 4417721
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ on:

jobs:
publish-whl:
if: ${{ inputs.ver }} != 'skip'
if: ${{ inputs.ver != 'skip' }}
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Make dist directory
run: mkdir -p dist
- name: Download all wheels
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: dist
- name: Publish to PyPI using trusted publishing
Expand Down
40 changes: 24 additions & 16 deletions .github/workflows/test-n-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,40 +25,48 @@ jobs:
strategy:
matrix:
pkg: ['Spine-Database-API', 'spine-engine', 'spine-items', 'Spine-Toolbox']

runs-on: ubuntu-latest
steps:
- name: Checkout ${{ matrix.pkg }}
uses: actions/checkout@v3
- name: Checkout ${{ matrix.pkg }} for publishing
if: ${{ inputs[matrix.pkg] != 'skip' }}
uses: actions/checkout@v4
with:
repository: 'spine-tools/${{ matrix.pkg }}'
path: ${{ matrix.pkg }}
ref: ${{ inputs[matrix.pkg] }}
- name: Checkout ${{ matrix.pkg }} for testing only
if: ${{ inputs[matrix.pkg] == 'skip' }}
uses: actions/checkout@v4
with:
repository: 'spine-tools/${{ matrix.pkg }}'
path: ${{ matrix.pkg }}
- name: Ensure Git checkout is not dirty
if: ${{ inputs[matrix.pkg] != 'skip' }}
run: cd ${{ matrix.pkg }} && git describe --tags --dirty | grep -vE '[-]dirty$'
- name: Ensure Git checkout does not have additional commits
if: ${{ inputs[matrix.pkg] != 'skip' }}
run: cd ${{ matrix.pkg }} && git describe --tags | grep -vE '[-]g[a-z0-9]{8}$'
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build
if: ${{ inputs[matrix.pkg] }} != 'skip'
if: ${{ inputs[matrix.pkg] != 'skip' }}
run: |
python -m build ${{ matrix.pkg }}
- name: Download wheels for packages excluded from build
if: ${{ inputs[matrix.pkg] }} == 'skip'
if: ${{ inputs[matrix.pkg] == 'skip' }}
run: |
mkdir -p ${{ matrix.pkg }}/dist/
sed -nEe 's/name[ ]*=[ ]*"?([a-z0-9_-]+)"?/\1/p' ${{ matrix.pkg }}/pyproject.toml > pkgname
python -m pip download --no-deps --python-version 3.8 \
python -m pip download --no-deps --python-version 3.8.1 \
--dest ${{ matrix.pkg }}/dist/ $(cat pkgname)
- name: Save ${{ matrix.pkg }} wheel
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.pkg }}
path: ${{ matrix.pkg }}/dist/*
Expand All @@ -77,31 +85,32 @@ jobs:
- name: Make dist directory
run: mkdir -p dist
- name: Download all wheels
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: dist
- name: Checkout ${{ matrix.pkg }}
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: 'spine-tools/${{ matrix.pkg }}'
path: ${{ matrix.pkg }}
ref: ${{ inputs[matrix.pkg] }}
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Upgrade Pip and install pytest
run: |
python -m pip install --upgrade pip
python -m pip install pytest
- name: Install pytest and built wheels on *NIX
if: runner.os != 'Windows'
run: |
python -m pip install --upgrade pip
ls dist
python -m pip install dist/*/*.whl
python -m pip install pytest
- name: Install pytest and built wheels on Windows
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade pip
Get-ChildItem ./dist/*.whl -Recurse | ForEach-Object {python -m pip install $_}
python -m pip install pytest
- name: Install additional packages for Linux
if: runner.os == 'Linux'
run: |
Expand Down Expand Up @@ -135,7 +144,6 @@ jobs:
strategy:
matrix:
pkg: ['Spine-Database-API', 'spine-engine', 'spine-items', 'Spine-Toolbox']

uses: ./.github/workflows/publish-wheel.yml
with:
pkg: ${{ matrix.pkg }}
Expand Down

0 comments on commit 4417721

Please sign in to comment.