Skip to content

Commit 08077d4

Browse files
committed
Move tests/qmods to its own ci workflow
1 parent eec6278 commit 08077d4

File tree

3 files changed

+95
-20
lines changed

3 files changed

+95
-20
lines changed

.github/workflows/Test-CI-main.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,6 @@ jobs:
128128
cp "${RUNNER_TEMP}/couenne" "${LOCAL_BIN}/couenne"
129129
chmod ugo+x "${LOCAL_BIN}/couenne"
130130
131-
- name: Download and install Qmod parser
132-
env:
133-
WHL_FILE_NAME: qmod_parser-0.0.0-cp311-cp311-linux_x86_64.whl
134-
S3_BUCKET_SOURCE: s3://public-library-resources
135-
run: |
136-
set -eux
137-
classiq_version=$(pip show classiq | awk '/Version:/ {print $2}')
138-
mkdir qmod_parser
139-
aws s3 cp "$S3_BUCKET_SOURCE/qmod_parser/$classiq_version/$WHL_FILE_NAME" "qmod_parser/$WHL_FILE_NAME"
140-
python -m pip install "qmod_parser/$WHL_FILE_NAME"
141-
142131
#
143132
# Setup Environment
144133
#
@@ -166,13 +155,6 @@ jobs:
166155
files: |
167156
**/notebooks/**/test_*.py
168157
169-
- name: Get changed Qmod files
170-
id: changed-files-qmod
171-
uses: tj-actions/changed-files@v46.0.1
172-
with:
173-
files: |
174-
**/*.qmod
175-
176158
# Run Tests
177159
- name: Run Notebooks (quick tests)
178160
run: python -m pytest -c tests/config_quick_tests.ini
@@ -195,6 +177,5 @@ jobs:
195177
SHOULD_TEST_ALL_FILES: "${{ env.SHOULD_TEST_ALL_FILES }}"
196178
LIST_OF_IPYNB_CHANGED: "${{ steps.changed-files-ipynb.outputs.all_changed_files }}"
197179
LIST_OF_IPYNB_TESTS_CHANGED: "${{ steps.changed-files-tests.outputs.all_changed_files }}"
198-
LIST_OF_QMOD_CHANGED: "${{ steps.changed-files-qmod.outputs.all_changed_files }}"
199180
# Altering test behavior
200181
LIMIT_TEST_LINKS_TO_FILES_ONLY: "false"

.github/workflows/Test-CI-qmod.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: "Test Library CI (qmods)"
2+
3+
on: [pull_request]
4+
5+
defaults:
6+
run:
7+
shell: bash
8+
9+
jobs:
10+
detect-qmod-changes:
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: read
15+
16+
outputs:
17+
has_any_qmod_file_changed: ${{ steps.changed-files.outputs.any_changed }}
18+
changed_qmod_files: ${{ steps.changed-files.outputs.all_changed_files }}
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
24+
- name: Check for changed QMOD files
25+
id: changed-files
26+
uses: tj-actions/changed-files@v46
27+
with:
28+
files: |
29+
**/*.qmod
30+
31+
test:
32+
needs: detect-qmod-changes
33+
if: needs.detect-qmod-changes.outputs.has_any_qmod_file_changed == 'true'
34+
35+
runs-on: ubuntu-latest
36+
37+
permissions:
38+
id-token: write
39+
contents: read
40+
41+
steps:
42+
#
43+
# Setup Python
44+
#
45+
- name: Set up Python
46+
uses: actions/setup-python@v5
47+
with:
48+
python-version: "3.11"
49+
50+
- name: Install dependencies
51+
run: |
52+
set -e
53+
python -m pip install -U pip
54+
python -m pip install -U -r requirements.txt
55+
python -m pip install -U -r requirements_tests.txt
56+
57+
#
58+
# Setup qmod_parser
59+
#
60+
# Configure AWS credentials
61+
- name: Configure AWS Credentials
62+
uses: aws-actions/configure-aws-credentials@v4.0.2
63+
with:
64+
role-to-assume: ${{ secrets.AWS_ROLE }}
65+
aws-region: us-east-1
66+
mask-aws-account-id: true
67+
68+
- name: Download and install Qmod parser
69+
env:
70+
WHL_FILE_NAME: qmod_parser-0.0.0-cp311-cp311-linux_x86_64.whl
71+
S3_BUCKET_SOURCE: s3://public-library-resources
72+
run: |
73+
set -eux
74+
classiq_version=$(pip show classiq | awk '/Version:/ {print $2}')
75+
mkdir qmod_parser
76+
aws s3 cp "$S3_BUCKET_SOURCE/qmod_parser/$classiq_version/$WHL_FILE_NAME" "qmod_parser/$WHL_FILE_NAME"
77+
python -m pip install "qmod_parser/$WHL_FILE_NAME"
78+
79+
#
80+
# Setup Environment
81+
#
82+
# Set authentication with M2M token
83+
- name: Set authentication
84+
run: .github/scripts/get_m2m_token.sh
85+
env:
86+
IS_DEV: "false"
87+
M2M_SECRET_ARN: "${{ secrets.PROD_M2M_SECRET_ARN }}"
88+
89+
# Run Tests
90+
- name: Run qmod tests
91+
run: python -m pytest tests/qmods/test_qmods.py
92+
env:
93+
# Passing which notebooks changed
94+
SHOULD_TEST_ALL_FILES: "true" # quick tests should run all files
95+
LIST_OF_QMOD_CHANGED: "${{ needs.detect-qmod-changes.outputs.changed_qmod_files }}"

tests/config_notebook_execute_tests.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[pytest]
22
testpaths =
3-
tests/qmods
43
tests/notebooks
54
tests/test_links
65

0 commit comments

Comments
 (0)