This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
forked from EnricoMi/publish-unit-test-result-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from im-open/ithd-233358-resync-code
ITHD-233358 Resync Code from Source
- Loading branch information
Showing
105 changed files
with
1,482 additions
and
1,972 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 |
---|---|---|
@@ -1 +1 @@ | ||
github: EnricoMi | ||
github: im-open |
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,136 @@ | ||
name: 'Test' | ||
author: 'im-open' | ||
description: 'A GitHub Action that tests this action' | ||
|
||
inputs: | ||
os: | ||
description: operating system, e.g. ubuntu-22.04 | ||
required: true | ||
python-version: | ||
description: Python version, e.g. 3.11 | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Setup Ubuntu | ||
if: startsWith(inputs.os, 'ubuntu') | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install language-pack-en language-pack-de | ||
shell: bash | ||
|
||
- name: Setup Python | ||
if: inputs.python-version != 'installed' | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Detect OS | ||
id: os | ||
env: | ||
OS: ${{ inputs.os }} | ||
run: | | ||
case "$OS" in | ||
ubuntu*) | ||
echo "pip-cache=~/.cache/pip" >> $GITHUB_OUTPUT | ||
;; | ||
macos*) | ||
echo "pip-cache=~/Library/Caches/pip" >> $GITHUB_OUTPUT | ||
;; | ||
windows*) | ||
echo "pip-cache=~\\AppData\\Local\\pip\\Cache" >> $GITHUB_OUTPUT | ||
;; | ||
esac | ||
echo "date=$(date +%Y%m%d 2> /dev/null || true)" >> $GITHUB_OUTPUT | ||
shell: bash | ||
|
||
- name: Cache PIP Packages | ||
uses: actions/cache@v3 | ||
id: cache | ||
with: | ||
path: ${{ steps.os.outputs.pip-cache }} | ||
key: ${{ inputs.os }}-pip-test-${{ inputs.python-version }}-${{ hashFiles('**/requirements.txt', '**/constraints.txt') }}-${{ steps.os.outputs.date }} | ||
restore-keys: | | ||
${{ inputs.os }}-pip-test-${{ inputs.python-version }}-${{ hashFiles('**/requirements.txt', '**/constraints.txt') }}- | ||
${{ inputs.os }}-pip-test-${{ inputs.python-version }}- | ||
${{ inputs.os }}-pip-test- | ||
- name: Install Python dependencies | ||
run: | | ||
python3 -V | ||
python3 -m pip freeze | sort | ||
python3 -m pip cache info || true | ||
python3 -m pip cache list || true | ||
python3 -m pip install --upgrade --force pip wheel | ||
python3 -m pip install --force -r python/requirements.txt | ||
python3 -m pip install --force -r python/test/requirements.txt -c python/test/constraints.txt | ||
python3 -m pip freeze | sort | ||
python3 -m pip cache info || true | ||
python3 -m pip cache list || true | ||
shell: bash | ||
|
||
- name: Update expectation files | ||
id: changes | ||
continue-on-error: true | ||
run: | | ||
python/test/files/update_expectations.sh | ||
git status | ||
if ! git diff --exit-code || [[ $(git ls-files -o --exclude-standard | wc -l) -gt 0 ]] | ||
then | ||
# we only upload the changed files if we can find zip | ||
if which zip | ||
then | ||
(git diff --name-only && git ls-files -o --exclude-standard) | xargs -d "\n" zip changed-expectations.zip | ||
exit 1 | ||
fi | ||
fi | ||
shell: bash | ||
- name: Upload changed expectation files | ||
if: steps.changes.outcome == 'failure' | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Changed expectations | ||
path: changed-expectations.zip | ||
if-no-files-found: error | ||
|
||
- name: PyTest | ||
env: | ||
PYTHONPATH: .. | ||
run: | | ||
cd python/test | ||
python3 -m pytest --capture=tee-sys --continue-on-collection-errors --junit-xml ../../test-results/pytest.xml | ||
shell: bash | ||
|
||
- name: PyTest (EST) | ||
env: | ||
TZ: US/Eastern | ||
LANG: "en_US.UTF-8" | ||
PYTHONPATH: .. | ||
run: | | ||
cd python/test | ||
python3 -m pytest --capture=tee-sys --continue-on-collection-errors --junit-xml ../../test-results/pytest-est.xml | ||
shell: bash | ||
|
||
- name: PyTest (CET) | ||
env: | ||
TZ: Europe/Berlin | ||
LANG: "de_DE.UTF-8" | ||
PYTHONPATH: .. | ||
run: | | ||
cd python/test | ||
python3 -m pytest --capture=tee-sys --continue-on-collection-errors --junit-xml ../../test-results/pytest-cet.xml | ||
shell: bash | ||
|
||
- name: Upload Test Results | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: Test Results (python-${{ inputs.python-version }}, ${{ inputs.os }}) | ||
path: | | ||
test-results/*.xml | ||
unit-test-results.json |
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
Oops, something went wrong.