diff --git a/.github/workflows/publish-wheel.yml b/.github/workflows/publish-wheel.yml index 1f33d12..b4822d0 100644 --- a/.github/workflows/publish-wheel.yml +++ b/.github/workflows/publish-wheel.yml @@ -14,7 +14,7 @@ on: jobs: publish-whl: - if: ${{ inputs.ver }} != 'skip' + if: ${{ inputs.ver != 'skip' }} runs-on: ubuntu-latest permissions: id-token: write @@ -22,7 +22,7 @@ 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: Publish to PyPI using trusted publishing diff --git a/.github/workflows/test-n-publish.yml b/.github/workflows/test-n-publish.yml index 4333595..cca8c6e 100644 --- a/.github/workflows/test-n-publish.yml +++ b/.github/workflows/test-n-publish.yml @@ -25,21 +25,29 @@ 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 @@ -47,18 +55,18 @@ jobs: 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 \ --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/* @@ -81,27 +89,28 @@ jobs: 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: | @@ -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 }}