Skip to content

Commit 05837fc

Browse files
Mike ProsserMike Prosser
authored andcommitted
fill out workflows, issue template, folder structure, etc
1 parent 01d3ec4 commit 05837fc

File tree

26 files changed

+1038
-100
lines changed

26 files changed

+1038
-100
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: 'bug,triage'
6+
---
7+
8+
<!---
9+
Thanks for filing an issue! Before you submit, please read the following:
10+
11+
Search open/closed issues before submitting. Someone may have reported the same issue before.
12+
-->
13+
14+
# Bug Report
15+
16+
<!--- Provide a general summary of the issue here -->
17+
18+
## Repro or Code Sample
19+
20+
<!-- Please provide steps to reproduce the issue and/or a code repository, gist, code snippet or sample files -->
21+
22+
## Expected Behavior
23+
24+
<!--- Tell us what should happen -->
25+
26+
## Current Behavior
27+
28+
<!--- Tell us what happens instead of the expected behavior -->
29+
<!--- If you are seeing an error, please include the full error message and stack trace -->
30+
<!--- If applicable, provide screenshots -->
31+
32+
## Possible Solution
33+
34+
<!--- Not obligatory, but suggest a fix/reason for the bug -->
35+
<!--- Please let us know if you'd be willing to contribute the fix; we'd be happy to work with you -->
36+
37+
## Context
38+
39+
<!--- How has this issue affected you? What are you trying to accomplish? -->
40+
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
41+
42+
## Your Environment
43+
44+
<!--- Include as many relevant details as possible about the environment you experienced the bug in -->
45+
46+
* `nipanel` version
47+
* Python version
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: 'enhancement,triage'
6+
---
7+
8+
<!---
9+
Thanks for filing an issue! Before you submit, please read the following:
10+
11+
Search open/closed issues before submitting. Someone may have requested the same feature before.
12+
-->
13+
14+
## Problem to Solve
15+
16+
<!--- Provide a clear and concise description of why this feature is wanted or what problem it solves. -->
17+
18+
## Proposed Solution
19+
20+
<!--- Provide a clear and concise description of the feature you're proposing. -->
21+
22+
<!--- The implementing team may build a list of tasks/sub-issues here:
23+
## Tasks
24+
- [ ] This is a subtask of the feature. (It can be converted to an issue.)
25+
-->
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
name: Tech debt
3+
about: (DEV TEAM ONLY) Non-user-visible improvement to code or development process
4+
title: ''
5+
labels: 'tech debt,triage'
6+
---
7+
## Tech Debt
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: User story
3+
about: (DEV TEAM ONLY) A small chunk of work to be done
4+
title: '(Fully descriptive title)'
5+
labels: 'user story,triage'
6+
---
7+
8+
<!-- Ensure the title can be understood without the parent item's context, e.g. "nimble-button Angular wrapper" rather than just "Angular wrapper" -->
9+
10+
## User Story

.github/workflows/CI.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'releases/**'
8+
workflow_call:
9+
workflow_dispatch:
10+
11+
jobs:
12+
check_nipanel:
13+
name: Check
14+
uses: ./.github/workflows/check_nipanel.yml
15+
run_unit_tests:
16+
name: Run unit tests
17+
uses: ./.github/workflows/run_unit_tests.yml
18+
needs: [check_nipanel]
19+
report_test_results:
20+
name: Report test results
21+
uses: ./.github/workflows/report_test_results.yml
22+
needs: [run_unit_tests]
23+
if: always()

.github/workflows/PR.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: PR
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
- 'releases/**'
8+
workflow_call:
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
run_ci:
17+
name: Run CI
18+
uses: ./.github/workflows/CI.yml
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Check nipanel
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
env:
8+
POETRY_VERSION: 1.8.2
9+
PYTHON_VERSION: 3.11.9
10+
11+
jobs:
12+
check_nipanel:
13+
name: Check nipanel
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out repo
17+
uses: actions/checkout@v4
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
id: setup-python
21+
with:
22+
python-version: ${{ env.PYTHON_VERSION }}
23+
- name: Set up Poetry
24+
uses: Gr1N/setup-poetry@v9
25+
with:
26+
poetry-version: ${{ env.POETRY_VERSION }}
27+
- name: Check for lock changes
28+
run: poetry check --lock
29+
- name: Restore cached virtualenv
30+
uses: actions/cache/restore@v4
31+
id: restore-nipanel
32+
with:
33+
path: .venv
34+
key: nipanel-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
35+
- name: Install nipanel
36+
run: poetry install -v
37+
- name: Save cached virtualenv
38+
uses: actions/cache/save@v4
39+
if: steps.restore-nipanel.outputs.cache-hit != 'true'
40+
with:
41+
path: .venv
42+
key: ${{ steps.restore-nipanel.outputs.cache-primary-key }}
43+
- name: Lint
44+
run: poetry run ni-python-styleguide lint
45+
- name: Mypy static analysis (Linux)
46+
run: poetry run mypy
47+
- name: Mypy static analysis (Windows)
48+
run: poetry run mypy --platform win32
49+
- name: Bandit security checks
50+
run: poetry run bandit -c pyproject.toml -r src/nipanel
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Report test results
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
checks: write
10+
pull-requests: write
11+
12+
jobs:
13+
report_test_results:
14+
name: Report test results
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out repo
18+
uses: actions/checkout@v4
19+
- name: Download test results
20+
uses: actions/download-artifact@v4
21+
with:
22+
path: test_results
23+
pattern: test_results_*
24+
merge-multiple: true
25+
- name: List downloaded files
26+
run: ls -lR
27+
- name: Publish test results
28+
uses: EnricoMi/publish-unit-test-result-action@v2
29+
with:
30+
files: "test_results/**/*.xml"
31+
if: always()
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Run unit tests
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
env:
8+
POETRY_VERSION: 1.8.2
9+
10+
jobs:
11+
run_unit_tests:
12+
name: Run unit tests
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [windows-latest, ubuntu-latest]
17+
python-version: [3.9, '3.10', 3.11, 3.12, 3.13]
18+
# Fail-fast skews the pass/fail ratio and seems to make pytest produce
19+
# incomplete JUnit XML results.
20+
fail-fast: false
21+
steps:
22+
- name: Check out repo
23+
uses: actions/checkout@v4
24+
- name: Set up Python
25+
uses: actions/setup-python@v5
26+
id: setup-python
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Set up Poetry
30+
uses: Gr1N/setup-poetry@v9
31+
with:
32+
poetry-version: ${{ env.POETRY_VERSION }}
33+
- name: Restore cached virtualenv
34+
uses: actions/cache/restore@v4
35+
id: restore-nipanel
36+
with:
37+
path: .venv
38+
key: nipanel-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
39+
- name: Install nipanel
40+
run: poetry install -v
41+
- name: Save cached virtualenv
42+
uses: actions/cache/save@v4
43+
if: steps.restore-nipanel.outputs.cache-hit != 'true'
44+
with:
45+
path: .venv
46+
key: ${{ steps.restore-nipanel.outputs.cache-primary-key }}
47+
- name: Run unit tests and code coverage
48+
run: poetry run pytest ./tests/unit -v --cov=nipanel --junitxml=test_results/nipanel-${{ matrix.os }}-py${{ matrix.python-version }}.xml
49+
- name: Upload test results
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: test_results_unit_${{ matrix.os }}_py${{ matrix.python-version }}
53+
path: ./test_results/*.xml
54+
if: always()
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Sync issue to Azure DevOps work item
2+
3+
on:
4+
issues:
5+
# Omit "labeled" and "unlabeled" to work around https://github.com/danhellem/github-actions-issue-to-work-item/issues/70
6+
types:
7+
[opened, edited, deleted, closed, reopened, assigned]
8+
issue_comment:
9+
types: [created, edited, deleted]
10+
11+
jobs:
12+
alert:
13+
if: ${{ !github.event.issue.pull_request && github.event.issue.title != 'Dependency Dashboard' }}
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Choose work item type
17+
id: choose_work_item_type
18+
run: |
19+
if [ "${{ contains(github.event.issue.labels.*.name, 'enhancement') || contains(github.event.issue.labels.*.name, 'user story') }}" == "true" ]; then
20+
echo "work_item_type=User Story" >> $GITHUB_OUTPUT
21+
elif [ "${{ contains(github.event.issue.labels.*.name, 'tech debt') }}" == "true" ]; then
22+
echo "work_item_type=Technical Debt" >> $GITHUB_OUTPUT
23+
else
24+
echo "work_item_type=Bug" >> $GITHUB_OUTPUT
25+
fi
26+
- uses: danhellem/[email protected]
27+
env:
28+
ado_token: "${{ secrets.AZDO_WORK_ITEM_TOKEN }}"
29+
github_token: "${{ secrets.GH_REPO_TOKEN }}"
30+
ado_organization: "ni"
31+
ado_project: "DevCentral"
32+
ado_area_path: "DevCentral\\Product RnD\\Platform HW and SW\\SW New Invest and Tech\\ETW\\Python CodeGen"
33+
ado_wit: "${{ steps.choose_work_item_type.outputs.work_item_type }}"
34+
ado_new_state: "New"
35+
ado_active_state: "Active"
36+
ado_close_state: "Closed"
37+
ado_bypassrules: true
38+
log_level: 100

0 commit comments

Comments
 (0)