Skip to content

.

. #12

Workflow file for this run

name: Tests
on:
- push
- pull_request
jobs:
pre_job:
# continue-on-error: true # Uncomment once integration is finished
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
concurrent_skipping: 'same_content_newer'
skip_after_successful_duplicate: 'true'
paths_ignore: '["**/README.md", "**/docs/**"]'
# do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
pytest:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0} # setup-miniconda requires bash
steps:
- uses: actions/checkout@v4
- run: |
echo "python_version=$(python3 scripts/get_python_version.py)" >> "$GITHUB_OUTPUT"
pip3 install --user uv maturin
id: get-python-version
- uses: actions/setup-python@v5
with:
python-version: ${{ steps.get-python-version.outputs.python_version }}
- name: Install dependencies
run: |
uv venv
source .venv/bin/activate
uv pip install -r deps/x86_64-unknown-linux-gnu/requirements_dev.txt
bash scripts/install.sh
- name: Run pytest
run: |
set +e # Do not exit shell on pytest failure
source .venv/bin/activate
python3 scripts/hf_download.py
out=$(pytest 2> stderr.txt)
exit_code=$?
err=$(<stderr.txt)
# Display the raw output in the step
echo "${out}"
echo "${err}"
# Display the Markdown output in the job summary
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
echo "${out}" >> $GITHUB_STEP_SUMMARY
echo "${err}" >> $GITHUB_STEP_SUMMARY
if [[ $exit_code -eq 5 ]]
then
echo
echo 'WARNING: No tests were run and it is considered as success' >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
exit 0
else
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
# Exit with the exit-code returned by pytest
exit ${exit_code}
fi
cargo-test:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0} # setup-miniconda requires bash
steps:
- uses: actions/checkout@v4
- name: Run cargo test
run: |
set +e # Do not exit shell on failure
cd rust
out=$(LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu cargo test 2> stderr.txt)
exit_code=$?
err=$(<stderr.txt)
# Display the raw output in the step
echo "${out}"
echo "${err}"
# Display the Markdown output in the job summary
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
echo "${out}" >> $GITHUB_STEP_SUMMARY
echo "${err}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
# Exit with the exit-code returned by test
exit ${exit_code}