Skip to content

Commit 4bf67bb

Browse files
authored
Merge pull request #1 from SECQUOIA/ci-testing
Comprehensive CI infrastructure modernization and enhancements
2 parents ea972b3 + 3ab3168 commit 4bf67bb

20 files changed

Lines changed: 1338 additions & 47 deletions
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: CI/Build Issue
2+
description: Report a problem with continuous integration or build processes
3+
title: "[CI]: "
4+
labels: ["ci", "infrastructure"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for reporting a CI/build issue. Please provide as much detail as possible.
10+
11+
- type: dropdown
12+
id: workflow
13+
attributes:
14+
label: Which workflow is affected?
15+
options:
16+
- CI (ci.yml)
17+
- Python PyTest (python-pytest.yml)
18+
- Code Formatting (python-yapf.yml)
19+
- Examples (python-example.yml)
20+
- Tutorials (python-tutorials.yml)
21+
- Code Coverage (coverage.yml)
22+
- PR Comment (pr-comment.yml)
23+
- Other
24+
validations:
25+
required: true
26+
27+
- type: input
28+
id: workflow-run
29+
attributes:
30+
label: Workflow Run URL
31+
description: Link to the failed workflow run
32+
placeholder: https://github.com/SECQUOIA/PySA/actions/runs/...
33+
validations:
34+
required: false
35+
36+
- type: dropdown
37+
id: python-version
38+
attributes:
39+
label: Python Version
40+
options:
41+
- "3.8"
42+
- "3.9"
43+
- "3.10"
44+
- "3.11"
45+
- "3.12"
46+
- All versions
47+
- Not applicable
48+
validations:
49+
required: false
50+
51+
- type: textarea
52+
id: description
53+
attributes:
54+
label: Description
55+
description: What happened? What did you expect to happen?
56+
placeholder: Describe the CI issue...
57+
validations:
58+
required: true
59+
60+
- type: textarea
61+
id: logs
62+
attributes:
63+
label: Relevant Log Output
64+
description: Please copy and paste any relevant log output from the workflow
65+
render: shell
66+
validations:
67+
required: false
68+
69+
- type: textarea
70+
id: steps
71+
attributes:
72+
label: Steps to Reproduce
73+
description: How can we reproduce this issue locally?
74+
placeholder: |
75+
1. Run command '...'
76+
2. See error '...'
77+
validations:
78+
required: false
79+
80+
- type: checkboxes
81+
id: checklist
82+
attributes:
83+
label: Checklist
84+
options:
85+
- label: I have checked the CI documentation (docs/CI_INFRASTRUCTURE.md)
86+
- label: I have verified this issue exists on the latest commit
87+
- label: I have checked existing issues for duplicates

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## Description
2+
<!-- Provide a brief description of the changes in this PR -->
3+
4+
## Type of Change
5+
<!-- Mark the relevant option with an "x" -->
6+
- [ ] Bug fix (non-breaking change which fixes an issue)
7+
- [ ] New feature (non-breaking change which adds functionality)
8+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
9+
- [ ] Documentation update
10+
- [ ] CI/Infrastructure update
11+
- [ ] Performance improvement
12+
- [ ] Code refactoring
13+
14+
## Related Issues
15+
<!-- Link to related issues using #issue_number -->
16+
Closes #
17+
18+
## Changes Made
19+
<!-- Describe the changes in detail -->
20+
-
21+
-
22+
-
23+
24+
## Testing
25+
<!-- Describe how you tested these changes -->
26+
- [ ] Unit tests pass locally (`pytest tests/`)
27+
- [ ] Code follows style guidelines (`yapf --style=google -d -r .`)
28+
- [ ] Added tests for new functionality
29+
- [ ] All examples run successfully
30+
- [ ] Tutorials execute without errors (if applicable)
31+
- [ ] Documentation updated (if needed)
32+
33+
## Checklist
34+
<!-- Mark completed items with an "x" -->
35+
- [ ] My code follows the project's style guidelines
36+
- [ ] I have performed a self-review of my code
37+
- [ ] I have commented my code, particularly in hard-to-understand areas
38+
- [ ] I have made corresponding changes to the documentation
39+
- [ ] My changes generate no new warnings
40+
- [ ] I have added tests that prove my fix is effective or that my feature works
41+
- [ ] New and existing unit tests pass locally with my changes
42+
- [ ] Any dependent changes have been merged and published
43+
44+
## Additional Notes
45+
<!-- Add any additional notes, context, or screenshots -->

.github/dependabot.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
version: 2
2+
updates:
3+
# GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
open-pull-requests-limit: 5
10+
labels:
11+
- "dependencies"
12+
- "github-actions"
13+
commit-message:
14+
prefix: "ci"
15+
include: "scope"
16+
17+
# Python dependencies
18+
- package-ecosystem: "pip"
19+
directory: "/"
20+
schedule:
21+
interval: "weekly"
22+
day: "monday"
23+
open-pull-requests-limit: 10
24+
labels:
25+
- "dependencies"
26+
- "python"
27+
commit-message:
28+
prefix: "deps"
29+
include: "scope"
30+
ignore:
31+
# Ignore major version updates for stable dependencies
32+
- dependency-name: "numpy"
33+
update-types: ["version-update:semver-major"]
34+
- dependency-name: "scipy"
35+
update-types: ["version-update:semver-major"]

.github/workflows/ci.yml

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, ci-testing ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
lint:
16+
name: Code Formatting Check
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.11"
25+
cache: 'pip'
26+
27+
- name: Install yapf
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install yapf==0.32.0
31+
pip install toml
32+
33+
- name: Check format with YAPF
34+
run: |
35+
yapf --style=google -d -r .
36+
37+
test:
38+
name: Test Python ${{ matrix.python-version }}
39+
runs-on: ubuntu-latest
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- name: Set up Python ${{ matrix.python-version }}
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: ${{ matrix.python-version }}
52+
cache: 'pip'
53+
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install -e . pytest pytest-cov pytest-xdist
58+
59+
- name: Run tests
60+
run: |
61+
pytest -rA -n auto --cov=pysa --cov-report=xml --cov-report=term tests/
62+
63+
- name: Upload coverage to artifact
64+
if: matrix.python-version == '3.11'
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: coverage-report
68+
path: coverage.xml
69+
retention-days: 7
70+
71+
coverage:
72+
name: Upload Coverage
73+
needs: test
74+
runs-on: ubuntu-latest
75+
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/main'
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Download coverage report
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: coverage-report
83+
84+
- name: Upload coverage to Codecov
85+
uses: codecov/codecov-action@v4
86+
with:
87+
token: ${{ secrets.CODECOV_TOKEN }}
88+
file: ./coverage.xml
89+
flags: unittests
90+
name: codecov-umbrella
91+
fail_ci_if_error: false
92+
continue-on-error: true
93+
94+
examples:
95+
name: Examples Python ${{ matrix.python-version }}
96+
runs-on: ubuntu-latest
97+
needs: test
98+
strategy:
99+
fail-fast: false
100+
matrix:
101+
python-version: ["3.9", "3.11"]
102+
103+
steps:
104+
- uses: actions/checkout@v4
105+
106+
- name: Set up Python ${{ matrix.python-version }}
107+
uses: actions/setup-python@v5
108+
with:
109+
python-version: ${{ matrix.python-version }}
110+
cache: 'pip'
111+
112+
- name: Install dependencies
113+
run: |
114+
python -m pip install --upgrade pip
115+
pip install -e . termplotlib
116+
117+
- name: Run examples
118+
run: |
119+
python examples/example_ising.py
120+
python examples/example_qubo.py
121+
python examples/example_ais.py
122+
123+
tutorials:
124+
name: Tutorials Python ${{ matrix.python-version }}
125+
runs-on: ubuntu-latest
126+
needs: test
127+
strategy:
128+
fail-fast: false
129+
matrix:
130+
python-version: ["3.9", "3.11"]
131+
132+
steps:
133+
- uses: actions/checkout@v4
134+
135+
- name: Set up Python ${{ matrix.python-version }}
136+
uses: actions/setup-python@v5
137+
with:
138+
python-version: ${{ matrix.python-version }}
139+
cache: 'pip'
140+
141+
- name: Install dependencies
142+
run: |
143+
python -m pip install --upgrade pip
144+
pip install -e . papermill matplotlib plotly jupyter hyperopt torch torchvision
145+
146+
- name: Run tutorials
147+
run: |
148+
cd tutorials/
149+
papermill example_ising.ipynb output_example_ising.ipynb || true
150+
papermill hpo_demo.ipynb output_hpo_demo.ipynb || true
151+
papermill ising_tutorial.ipynb output_ising_tutorial.ipynb || true
152+
papermill RBM_tutorial.ipynb output_RBM_tutorial.ipynb || true
153+
154+
- name: Upload tutorial outputs
155+
if: always()
156+
uses: actions/upload-artifact@v4
157+
with:
158+
name: tutorial-outputs-py${{ matrix.python-version }}
159+
path: tutorials/output_*.ipynb
160+
retention-days: 7
161+
continue-on-error: true
162+
163+
all-checks-passed:
164+
name: All Checks Passed
165+
needs: [lint, test, examples, tutorials]
166+
runs-on: ubuntu-latest
167+
if: always()
168+
steps:
169+
- name: Check if all jobs passed
170+
run: |
171+
if [[ "${{ needs.lint.result }}" != "success" ]] || \
172+
[[ "${{ needs.test.result }}" != "success" ]] || \
173+
[[ "${{ needs.examples.result }}" != "success" ]] || \
174+
[[ "${{ needs.tutorials.result }}" != "success" ]]; then
175+
echo "One or more jobs failed"
176+
exit 1
177+
fi
178+
echo "All checks passed successfully!"

0 commit comments

Comments
 (0)