-
Notifications
You must be signed in to change notification settings - Fork 226
77 lines (63 loc) · 2.33 KB
/
sketching.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# This workflow will test only https://github.com/google/neural-tangents/pull/142
# Copied from github.com/google/jax-md and github.com/google/jax
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: sketching
on:
push:
branches:
- '*/NT'
pull_request:
branches:
- main
jobs:
Sketching:
timeout-minutes: 240
strategy:
matrix:
python-version: [3.11]
JAX_ENABLE_X64: [0, 1]
runs-on: ubuntu-latest
steps:
- name: Cancel previous
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4.1.7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install numpy jaxlib --upgrade
pip install -e .
pip install -e .[testing]
pip install pytest
pip install pytest-xdist
pip install pytest-cov
- name: Test with pytest and generate coverage report (Ubuntu)
run: |
JAX_ENABLE_X64=${{ matrix.JAX_ENABLE_X64 }} PYTHONHASHSEED=0 pytest experimental/tests/ -n auto --cov=experimental/ --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.5.0
with:
file: ./coverage.xml
# The below step just reports the success or failure of tests as a "commit status".
# This is needed for copybara integration.
- name: Report success or failure as github status
if: always()
shell: bash
run: |
status="${{ job.status }}"
lowercase_status=$(echo $status | tr '[:upper:]' '[:lower:]')
curl -sS --request POST \
--url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"state": "'$lowercase_status'",
"target_url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"description": "'$status'",
"context": "github-actions/sketching"
}'