Converting tests that use lab to lab_dev #3159
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
name: Tensorflow tests | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
jobs: | |
pytest: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # This is required for requesting the JWT for S3 access | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.12'] | |
concurrency: | |
group: ${{ github.workflow }}-${{ matrix.python-version }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
HYPOTHESIS_PROFILE: ci | |
UPLOAD_TIMINGS: ${{ github.event_name == 'push' && matrix.python-version == '3.12' && 'true' || 'false' }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
version: "0.5.23" | |
- name: Create durations file name | |
id: record_file | |
run: echo "filename=durations_$(date +%s)_$(git rev-parse --short HEAD).txt" >> "$GITHUB_OUTPUT" | |
- name: Run tests | |
run: | | |
set -o pipefail | |
uv run --all-extras pytest tests --backend=tensorflow --cov=mrmustard --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native ${{ env.UPLOAD_TIMINGS == 'true' && '--durations=0 -vv ' || '' }}| tee durations.txt | |
set +o pipefail | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
fail_ci_if_error: true | |
- name: configure aws credentials | |
if: env.UPLOAD_TIMINGS == 'true' | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_ARN }} | |
aws-region: ${{ vars.AWS_DEFAULT_REGION }} | |
- name: Copy durations to s3 | |
if: env.UPLOAD_TIMINGS == 'true' | |
env: | |
REF_NAME: ${{ github.ref_name }} | |
run: | | |
grep ' call ' durations.txt | awk '{print $3,$1}' > ${{ steps.record_file.outputs.filename }} | |
aws s3 cp ./${{ steps.record_file.outputs.filename }} s3://${{ secrets.AWS_TIMINGS_BUCKET }}/tf_tests/$REF_NAME/ |