-
Notifications
You must be signed in to change notification settings - Fork 869
77 lines (67 loc) · 2.71 KB
/
run_tests.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
name: "Test notebooks"
on:
pull_request:
push:
branches:
- CAD-22795
jobs:
tests:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Get changed files - all
id: changed-files-all
uses: tj-actions/changed-files@v44
- name: Get changed files - ipynb
id: changed-files-ipynb
uses: tj-actions/changed-files@v44
with:
files: |
**.ipynb
- uses: aws-actions/[email protected]
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: us-east-1
mask-aws-account-id: true
- name: Set environment variables
run: |
set -ex
echo "CLASSIQ_TEXT_ONLY=true" >> $GITHUB_ENV
if [ "$GITHUB_EVENT" == 'pull_request' ]; then
echo "SHOULD_TEST_ALL_FILES=false" >> $GITHUB_ENV
echo "HAS_ANY_FILE_CHANGED=${{ steps.changed-files-all.outputs.any_changed }}" >> $GITHUB_ENV
echo "LIST_OF_FILE_CHANGED=${{ steps.changed-files-all.outputs.all_changed_files }}" >> $GITHUB_ENV
echo "HAS_ANY_IPYNB_CHANGED=${{ steps.changed-files-ipynb.outputs.any_changed }}" >> $GITHUB_ENV
echo "LIST_OF_IPYNB_CHANGED=${{ steps.changed-files-ipynb.outputs.all_changed_files }}" >> $GITHUB_ENV
elif [[ "$GITHUB_EVENT" == 'workflow_dispatch' || "${{ github.head_ref || github.ref_name }}" == "CAD-22795" ]]; then
echo "SHOULD_TEST_ALL_FILES=true" >> $GITHUB_ENV
echo "HAS_ANY_FILE_CHANGED=None" >> $GITHUB_ENV
echo "LIST_OF_FILE_CHANGED=None" >> $GITHUB_ENV
echo "HAS_ANY_IPYNB_CHANGED=None" >> $GITHUB_ENV
echo "LIST_OF_IPYNB_CHANGED=None" >> $GITHUB_ENV
fi
if [ "${{ github.head_ref || github.ref_name }}" == "CAD-22795" ]; then
echo "CLASSIQ_IDE=https://nightly.platform.classiq.io" >> $GITHUB_ENV
echo "CLASSIQ_HOST=https://staging.api.classiq.io" >> $GITHUB_ENV
fi
env:
GITHUB_EVENT: "${{ github.event_name }}"
GITHUB_REF: "${{ github.head_ref || github.ref_name }}"
- name: Set authentication
run: .github/scripts/get_m2m_token.sh
env:
PROD_M2M_SECRET_ARN: "${{ secrets.PROD_M2M_SECRET_ARN }}"
NIGHTLY_M2M_SECRET_ARN: "${{ secrets.NIGHTLY_M2M_SECRET_ARN }}"
- name: "Install dependencies"
run: .github/scripts/install_deps.sh
- name: "Run tests"
run: python -m pytest tests
env:
JUPYTER_PLATFORM_DIRS: "1"