-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workflows: factor out testing to be able to use
if:
- Loading branch information
Showing
2 changed files
with
88 additions
and
56 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Reusable workflow to publish Spine package wheels | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
pkg: | ||
description: Package name | ||
type: string | ||
required: true | ||
ver: | ||
description: Release tag | ||
type: string | ||
required: true | ||
os: | ||
description: Operating System/Platform | ||
type: string | ||
required: true | ||
python: | ||
description: Python version | ||
type: string | ||
required: true | ||
|
||
jobs: | ||
test-whl: | ||
if: inputs.ver != 'skip' | ||
runs-on: ${{ inputs.os }} | ||
steps: | ||
- name: Make dist directory | ||
run: mkdir -p dist | ||
- name: Download all wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: dist | ||
- name: Checkout ${{ inputs.pkg }} | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: 'spine-tools/${{ inputs.pkg }}' | ||
path: ${{ inputs.pkg }} | ||
ref: ${{ inputs[inputs.pkg] != 'skip' && inputs[matrix.pkg] || 'master' }} | ||
- name: Set up Python ${{ inputs.python }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python }} | ||
- name: Install pytest and built wheels on *NIX | ||
if: runner.os != 'Windows' | ||
run: | | ||
python -m pip install --upgrade pip | ||
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: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y libegl1 | ||
- name: Remove source from checkouts for *NIX | ||
if: runner.os != 'Windows' | ||
run: | | ||
rm -rf Spine-Toolbox/spinetoolbox* spine-items/spine_items \ | ||
spine-engine/spine_engine Spine-Database-API/spinedb_api | ||
- name: Remove source from checkouts for Windows | ||
if: runner.os == 'Windows' | ||
run: | | ||
Remove-Item Spine-Toolbox\spinetoolbox* -Recurse -Force -ErrorAction Ignore | ||
Remove-Item spine-items\spine_items -Recurse -Force -ErrorAction Ignore | ||
Remove-Item spine-engine\spine_engine -Recurse -Force -ErrorAction Ignore | ||
Remove-Item Spine-Database-API\spinedb_api -Recurse -Force -ErrorAction Ignore | ||
- name: Test wheels | ||
env: | ||
QT_QPA_PLATFORM: offscreen | ||
run: | | ||
python -m unittest discover -s ${{ inputs.pkg }} --verbose | ||
- name: Execution tests | ||
if: inputs.pkg == 'Spine-Toolbox' | ||
run: | | ||
python -m unittest discover -s ${{ inputs.pkg }} --pattern execution_test.py --verbose |