Skip to content

Batch Refactor

Batch Refactor #2924

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
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
HYPOTHESIS_PROFILE: ci
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup Julia
uses: julia-actions/setup-julia@v1
with:
version: 1.9.3
- name: Install dependencies
run: |
python -m pip install --no-cache-dir --upgrade pip
pip install --no-cache-dir poetry==1.8.0
poetry config virtualenvs.create false
poetry install --extras "ray" --with dev
- name: Initialize Julia project # to keep test times stable
run: python -c 'from juliacall import Main as jl'
- 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
python -m pytest tests --backend=tensorflow --cov=mrmustard --cov-report=term-missing --cov-report=xml -p no:warnings --tb=native ${{ github.event_name == 'push' && '--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: github.event_name == 'push'
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: github.event_name == 'push'
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/${{ github.ref_name }}/