-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make GitHub unit/execution test actions callable (#2977)
- Loading branch information
Showing
3 changed files
with
146 additions
and
78 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Execution tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
host-os: | ||
required: true | ||
type: string | ||
python-version: | ||
required: true | ||
type: string | ||
repository: | ||
required: false | ||
type: string | ||
default: ${{ github.repository }} | ||
post-installation-command: | ||
required: false | ||
type: string | ||
default: "" | ||
secrets: | ||
CODECOV_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
execution-tests: | ||
name: Run execution tests | ||
runs-on: ${{ inputs.host-os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.repository }} | ||
- name: Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
cache: pip | ||
cache-dependency-path: | | ||
pyproject.toml | ||
requirements.txt | ||
dev-requirements.txt | ||
- name: Install additional packages for Linux | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y libegl1 | ||
- name: Install dependencies | ||
env: | ||
PYTHONUTF8: 1 | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -r requirements.txt | ||
python -m pip install -r dev-requirements.txt | ||
- name: Run post-install command | ||
if: ${{ inputs.post-installation-command }} | ||
run: | ||
${{ inputs.post-installation-command }} | ||
- name: Run tests | ||
run: | ||
python -m unittest discover --pattern execution_test.py --verbose |
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,75 @@ | ||
name: Unit tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
host-os: | ||
required: true | ||
type: string | ||
python-version: | ||
required: true | ||
type: string | ||
repository: | ||
required: false | ||
type: string | ||
default: ${{ github.repository }} | ||
coverage: | ||
required: false | ||
type: boolean | ||
default: true | ||
post-installation-command: | ||
required: false | ||
type: string | ||
default: "" | ||
secrets: | ||
CODECOV_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
unit-tests: | ||
name: Run unit tests | ||
runs-on: ${{ inputs.host-os }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ inputs.repository }} | ||
fetch-depth: 0 | ||
- name: Version from Git tags | ||
run: git describe --tags | ||
- name: Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
cache: pip | ||
cache-dependency-path: | | ||
pyproject.toml | ||
requirements.txt | ||
dev-requirements.txt | ||
- name: Install additional packages for Linux | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get update -y | ||
sudo apt-get install -y libegl1 | ||
- name: Install dependencies | ||
env: | ||
PYTHONUTF8: 1 | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install -r requirements.txt | ||
python -m pip install -r dev-requirements.txt | ||
- name: Run post-install command | ||
if: ${{ inputs.post-installation-command }} | ||
run: | ||
${{ inputs.post-installation-command }} | ||
- name: Run tests | ||
run: | | ||
if [ "$RUNNER_OS" != "Windows" ]; then | ||
export QT_QPA_PLATFORM=offscreen | ||
fi | ||
${{ inputs.coverage && 'coverage run' || 'python' }} -m unittest discover --verbose | ||
shell: bash | ||
- name: Upload coverage report to Codecov | ||
if: ${{ inputs.coverage }} | ||
uses: codecov/codecov-action@v4 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |