Skip to content

Commit a5d68d0

Browse files
author
Mark
committed
workflows
1 parent 27d64a7 commit a5d68d0

11 files changed

Lines changed: 400 additions & 0 deletions

File tree

.github/CODEOWNERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Planning service code
2+
/app/service/planning_svc.py @mitre/squad-x
3+
/app/service/interfaces/i_planning_svc.py @mitre/squad-x
4+
/app/utility/base_planning_svc.py @mitre/squad-x
5+
/tests/services/test_planning_svc.py @mitre/squad-x
6+
/requirements.txt @elegantmoose
7+
8+
# UI
9+
/templates/ @mitre/squad-q
10+
/static/ @mitre/squad-q
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: "\U0001F41E Bug report"
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: elegantmoose
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1.
16+
17+
**Expected behavior**
18+
A clear and concise description of what you expected to happen.
19+
20+
**Screenshots**
21+
If applicable, add screenshots to help explain your problem.
22+
23+
**Desktop (please complete the following information):**
24+
- OS: [e.g. Mac, Windows, Kali]
25+
- Browser [e.g. chrome, safari]
26+
- Version [e.g. 2.8.0]
27+
28+
**Additional context**
29+
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
contact_links:
2+
- name: Documentation
3+
url: https://caldera.readthedocs.io/en/latest/
4+
about: Your question may be answered in the documentation
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: "\U0001F680 New Feature Request"
3+
about: Propose a new feature
4+
title: ''
5+
labels: feature
6+
assignees: elegantmoose
7+
8+
---
9+
10+
**What problem are you trying to solve? Please describe.**
11+
> Eg. I'm always frustrated when [...]
12+
13+
14+
**The ideal solution: What should the feature should do?**
15+
> a clear and concise description
16+
17+
18+
**What category of feature is this?**
19+
20+
- [ ] UI/UX
21+
- [ ] API
22+
- [ ] Other
23+
24+
**If you have code or pseudo-code please provide:**
25+
26+
<!-- Put your code examples here -->
27+
```python
28+
29+
```
30+
31+
- [ ] Willing to submit a pull request to implement this feature?
32+
33+
**Additional context**
34+
Add any other context or screenshots about the feature request here.
35+
36+
Thank you for your contribution!

.github/ISSUE_TEMPLATE/question.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: "\U00002753 Question"
3+
about: Support questions
4+
title: ''
5+
labels: question
6+
assignees: ''
7+
8+
---
9+
10+
11+
12+
13+
<!--
14+
Please see our documentation here: https://caldera.readthedocs.io/en/latest/
15+
16+
If you'd like to help us improve our documentation please open a pull request here: https://github.com/mitre/fieldmanual
17+
-->

.github/pull_request_template.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Description
2+
3+
(insert summary)
4+
5+
## Type of change
6+
7+
Please delete options that are not relevant.
8+
9+
- [ ] Bug fix (non-breaking change which fixes an issue)
10+
- [ ] New feature (non-breaking change which adds functionality)
11+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12+
- [ ] This change requires a documentation update
13+
14+
## How Has This Been Tested?
15+
16+
Please describe the tests that you ran to verify your changes.
17+
18+
19+
## Checklist:
20+
21+
- [ ] My code follows the style guidelines of this project
22+
- [ ] I have performed a self-review of my own code
23+
- [ ] I have made corresponding changes to the documentation
24+
- [ ] I have added tests that prove my fix is effective or that my feature works

.github/workflows/greetings.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Greetings
2+
3+
on: [pull_request, issues]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
greeting:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
steps:
15+
- uses: actions/first-interaction@1d8459ca65b335265f1285568221e229d45a995e
16+
with:
17+
repo-token: ${{ secrets.GITHUB_TOKEN }}
18+
issue-message: 'Looks like your first issue -- we aim to respond to issues as quickly as possible. In the meantime, check out our documentation here: http://caldera.readthedocs.io/'
19+
pr-message: 'Wohoo! Your first PR -- thanks for contributing!'
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
env:
12+
REGISTRY: ghcr.io
13+
IMAGE_NAME: ${{ github.repository }}
14+
15+
jobs:
16+
build-and-push-image:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
25+
with:
26+
submodules: recursive
27+
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata (tags, labels) for Docker (slim variant)
36+
id: meta-slim
37+
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
flavor: |
41+
latest=auto
42+
prefix=slim-,onlatest=true
43+
suffix=
44+
45+
- name: Build and push Docker image (slim)
46+
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
47+
with:
48+
context: .
49+
push: true
50+
tags: ${{ steps.meta-slim.outputs.tags }}
51+
labels: ${{ steps.meta-slim.outputs.labels }}
52+
build-args: |
53+
VARIANT=slim
54+
55+
- name: Extract metadata (tags, labels) for Docker (full variant)
56+
id: meta-full
57+
uses: docker/metadata-action@818d4b7b91585d195f67373fd9cb0332e31a7175
58+
with:
59+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
60+
61+
- name: Build and push Docker image (full)
62+
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
63+
with:
64+
context: .
65+
push: true
66+
tags: ${{ steps.meta-full.outputs.tags }}
67+
labels: ${{ steps.meta-full.outputs.labels }}
68+
build-args: |
69+
VARIANT=full

.github/workflows/quality.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Code Quality
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types: [opened, synchronize, reopened, ready_for_review]
9+
pull_request_target:
10+
types: [opened, synchronize, reopened, ready_for_review] # added for fork PRs
11+
workflow_dispatch:
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
pull-requests: read
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
include:
26+
- python-version: 3.10.9
27+
toxenv: py310,style,coverage-ci
28+
- python-version: 3.11
29+
toxenv: py311,style,coverage-ci
30+
- python-version: 3.12
31+
toxenv: py312,style,coverage-ci
32+
33+
steps:
34+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
35+
with:
36+
submodules: recursive
37+
fetch-depth: 0 # shallow clones should be disabled for analysis
38+
39+
- name: Setup python
40+
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c
41+
with:
42+
python-version: ${{ matrix.python-version }}
43+
44+
- name: Setup Node.js
45+
uses: actions/setup-node@v3
46+
with:
47+
node-version: '20'
48+
49+
- name: Install dependencies
50+
run: |
51+
pip install --upgrade virtualenv
52+
pip install tox
53+
npm --prefix plugins/magma install
54+
npm --prefix plugins/magma run build
55+
56+
- name: Run tests
57+
env:
58+
TOXENV: ${{ matrix.toxenv }}
59+
run: tox
60+
61+
# --- Sonar scan for pushes and same-repo PRs only ---
62+
- name: SonarQube Scan
63+
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false }}
64+
uses: SonarSource/sonarqube-scan-action@v6.0.0
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # needed for PR info
67+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
68+
# Uncomment if your sonar-project.properties is in a subfolder:
69+
# with:
70+
# args: |
71+
# -Dsonar.projectBaseDir=caldera
72+
73+
# --- Sonar scan for forked PRs (runs safely with pull_request_target) ---
74+
sonar_fork_pr:
75+
runs-on: ubuntu-latest
76+
if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.fork }}
77+
permissions:
78+
contents: read
79+
pull-requests: write # remove if you don't want PR comments
80+
steps:
81+
- name: Checkout base repo
82+
uses: actions/checkout@v4
83+
with:
84+
ref: ${{ github.event.pull_request.base.sha }}
85+
fetch-depth: 0
86+
87+
- name: Checkout PR HEAD (fork)
88+
uses: actions/checkout@v4
89+
with:
90+
repository: ${{ github.event.pull_request.head.repo.full_name }}
91+
ref: ${{ github.event.pull_request.head.sha }}
92+
path: pr
93+
fetch-depth: 0
94+
submodules: recursive
95+
96+
# Detect where the sonar-project.properties actually is (pr/ or pr/caldera)
97+
- name: Detect Sonar base dir
98+
id: detect
99+
run: |
100+
set -euo pipefail
101+
if [ -f pr/caldera/sonar-project.properties ]; then
102+
echo "base=pr/caldera" >> "$GITHUB_OUTPUT"
103+
elif [ -f pr/sonar-project.properties ]; then
104+
echo "base=pr" >> "$GITHUB_OUTPUT"
105+
else
106+
echo "No sonar-project.properties found under pr/ or pr/caldera"
107+
echo "base=pr" >> "$GITHUB_OUTPUT" # fallback to repo root
108+
fi
109+
echo "Using base dir: $(grep '^base=' "$GITHUB_OUTPUT" | cut -d= -f2)"
110+
echo "Has SONAR_TOKEN? $([ -n "${SONAR_TOKEN:-}" ] && echo yes || echo no)"
111+
env:
112+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
113+
114+
# If your project key/org are NOT in the properties file, uncomment and set below
115+
- name: SonarQube Scan (fork PR)
116+
uses: SonarSource/sonarqube-scan-action@v6.0.0
117+
env:
118+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
# SONAR_HOST_URL: https://sonarcloud.io # set if you’re self-hosted or non-default
121+
with:
122+
projectBaseDir: ${{ steps.detect.outputs.base }}
123+
args: |
124+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
125+
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
126+
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}

.github/workflows/security.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Security Checks
2+
3+
on: [push]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
# - python-version: 3.9
16+
# toxenv: safety
17+
- python-version: 3.10.9
18+
toxenv: safety
19+
- python-version: 3.11
20+
toxenv: safety
21+
22+
steps:
23+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
24+
with:
25+
submodules: recursive
26+
- name: Setup python
27+
uses: actions/setup-python@3542bca2639a428e1796aaa6a2ffef0c0f575566
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- name: Install dependencies
31+
run: |
32+
pip install --upgrade virtualenv
33+
pip install tox
34+
- name: Run tests
35+
env:
36+
TOXENV: ${{ matrix.toxenv }}
37+
run: tox

0 commit comments

Comments
 (0)