Skip to content

Commit 24c805d

Browse files
nightkrrazvan
andauthored
Add CI and github config (#12)
* Add CI and github config Mostly copied from operator-rs. Would be nice to have this managed by operator-templating, but that depends on stackabletech/operator-templating#80. * Import pre-commit and cargo deny config as well * pre-commit * Update cargo-deny to v2.0.4 * Update dependencies * Update deny.toml from op-rs * Update .github/workflows/build.yml Co-authored-by: Razvan-Daniel Mihai <[email protected]> --------- Co-authored-by: Razvan-Daniel Mihai <[email protected]>
1 parent d085629 commit 24c805d

11 files changed

+911
-220
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: "🐛 Bug Report"
3+
description: "If something isn't working as expected 🤔."
4+
labels: ["type/bug"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: Thanks for taking the time to file a bug report! Please fill out this form as completely as possible.
9+
10+
- type: input
11+
attributes:
12+
label: Affected version
13+
description: Which version do you see this bug in?
14+
15+
- type: textarea
16+
attributes:
17+
label: Current and expected behavior
18+
description: A clear and concise description of what operator-rs is doing and what you would expect.
19+
validations:
20+
required: true
21+
22+
- type: textarea
23+
attributes:
24+
label: Possible solution
25+
description: "If you have suggestions on a fix for the bug."
26+
27+
- type: textarea
28+
attributes:
29+
label: Additional context
30+
description: "Add any other context about the problem here. Or a screenshot if applicable."
31+
32+
- type: textarea
33+
attributes:
34+
label: Environment
35+
description: |
36+
What type of kubernetes cluster you are running aginst (k3s/eks/aks/gke/other) and any other information about your environment?
37+
placeholder: |
38+
Examples:
39+
Output of `kubectl version --short`
40+
41+
- type: dropdown
42+
attributes:
43+
label: Would you like to work on fixing this bug?
44+
description: |
45+
**NOTE**: Let us know if you would like to submit a PR for this. We are more than happy to help you through the process.
46+
options:
47+
- "yes"
48+
- "no"
49+
- "maybe"

.github/ISSUE_TEMPLATE/config.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
blank_issues_enabled: true
3+
contact_links:
4+
- name: 🙋🏾 Question
5+
about: Use this to ask a question about this project
6+
url: https://github.com/orgs/stackabletech/discussions/new?category=q-a
7+
- name: 🚀 Feature Requests and other things
8+
about: Open an issue with your feature request or any other issue not covered elsewhere
9+
url: https://github.com/stackabletech/containerdebug/issues/new

.github/pull_request_template.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Description
2+
3+
*Please add a description here. This will become the commit message of the merge request later.*
4+
5+
## Definition of Done Checklist
6+
7+
- Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
8+
- Please make sure all these things are done and tick the boxes
9+
10+
```[tasklist]
11+
# Author
12+
- [ ] Changes are OpenShift compatible
13+
- [ ] Integration tests passed (for non trivial changes)
14+
```
15+
16+
```[tasklist]
17+
# Reviewer
18+
- [ ] Code contains useful comments
19+
- [ ] (Integration-)Test cases added
20+
- [ ] Documentation added or updated
21+
- [ ] Changelog updated
22+
- [ ] Cargo.toml only contains references to git tags (not specific commits or branches)
23+
```
24+
25+
```[tasklist]
26+
# Acceptance
27+
- [ ] Feature Tracker has been updated
28+
- [ ] Proper release label has been added
29+
```

.github/workflows/build.yml

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
name: Stackable Build Pipeline
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
- staging
9+
- trying
10+
- "renovate/**"
11+
tags:
12+
- "*"
13+
pull_request:
14+
merge_group:
15+
16+
env:
17+
CARGO_TERM_COLOR: always
18+
CARGO_INCREMENTAL: "0"
19+
CARGO_PROFILE_DEV_DEBUG: "0"
20+
RUST_TOOLCHAIN_VERSION: "1.82.0"
21+
RUSTFLAGS: "-D warnings"
22+
RUSTDOCFLAGS: "-D warnings"
23+
RUST_LOG: "info"
24+
25+
jobs:
26+
# Identify unused dependencies
27+
run_udeps:
28+
name: Run Cargo Udeps
29+
runs-on: ubuntu-latest
30+
env:
31+
RUSTC_BOOTSTRAP: 1
32+
steps:
33+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
34+
- uses: dtolnay/rust-toolchain@master
35+
with:
36+
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
37+
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5
38+
with:
39+
key: udeps
40+
- run: cargo install --locked [email protected]
41+
- run: cargo udeps --all-targets --all-features
42+
43+
run_cargodeny:
44+
name: Run Cargo Deny
45+
runs-on: ubuntu-latest
46+
strategy:
47+
matrix:
48+
checks:
49+
- advisories
50+
- bans licenses sources
51+
52+
# Prevent sudden announcement of a new advisory from failing ci:
53+
continue-on-error: ${{ matrix.checks == 'advisories' }}
54+
55+
steps:
56+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
57+
- uses: EmbarkStudios/cargo-deny-action@e2f4ede4a4e60ea15ff31bc0647485d80c66cfba # v2.0.4
58+
with:
59+
command: check ${{ matrix.checks }}
60+
61+
run_rustfmt:
62+
name: Run Rustfmt
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
66+
- uses: dtolnay/rust-toolchain@master
67+
with:
68+
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
69+
components: rustfmt
70+
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5
71+
with:
72+
key: fmt
73+
- run: cargo fmt --all -- --check
74+
75+
run_clippy:
76+
name: Run Clippy
77+
runs-on: ubuntu-latest
78+
steps:
79+
- name: Install host dependencies
80+
run: |
81+
sudo apt-get update
82+
sudo apt-get install protobuf-compiler krb5-user libkrb5-dev libclang-dev liblzma-dev libssl-dev pkg-config
83+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
84+
with:
85+
submodules: recursive
86+
- uses: dtolnay/rust-toolchain@master
87+
with:
88+
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
89+
components: clippy
90+
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5
91+
with:
92+
key: clippy
93+
- name: Run clippy action to produce annotations
94+
# NOTE (@Techassi): This action might get a new release soon, because it
95+
# currently uses Node 16, which is deprecated in the next few months by
96+
# GitHub. See https://github.com/giraffate/clippy-action/pull/87
97+
uses: giraffate/clippy-action@13b9d32482f25d29ead141b79e7e04e7900281e0 # v1.0.1
98+
env:
99+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
if: env.GITHUB_TOKEN != null && github.event.pull_request.draft == false
101+
with:
102+
clippy_flags: --all-targets -- -D warnings
103+
reporter: "github-pr-review"
104+
github_token: ${{ secrets.GITHUB_TOKEN }}
105+
- name: Run clippy manually without annotations
106+
env:
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
if: env.GITHUB_TOKEN == null
109+
run: cargo clippy --color never -q --all-targets -- -D warnings
110+
111+
run_rustdoc:
112+
name: Run RustDoc
113+
runs-on: ubuntu-latest
114+
steps:
115+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
116+
- uses: dtolnay/rust-toolchain@master
117+
with:
118+
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
119+
components: rustfmt
120+
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5
121+
with:
122+
key: doc
123+
- run: cargo doc --document-private-items
124+
125+
run_tests:
126+
name: Run Cargo Tests
127+
needs:
128+
- run_clippy
129+
- run_rustfmt
130+
- run_rustdoc
131+
runs-on: ubuntu-latest
132+
steps:
133+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
134+
- uses: dtolnay/rust-toolchain@master
135+
with:
136+
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
137+
# rust-src is required for trybuild stderr output comparison to work
138+
# for our cases.
139+
# See: https://github.com/dtolnay/trybuild/issues/236#issuecomment-1620950759
140+
components: rust-src
141+
- uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5
142+
with:
143+
key: test
144+
- run: cargo test --all-features
145+
146+
tests_passed:
147+
name: All tests passed
148+
needs:
149+
- run_udeps
150+
- run_tests
151+
runs-on: ubuntu-latest
152+
steps:
153+
- name: log
154+
run: echo All tests have passed!

.github/workflows/daily_security.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Security audit
3+
4+
on:
5+
schedule:
6+
- cron: '15 4 * * *'
7+
workflow_dispatch:
8+
9+
jobs:
10+
audit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
14+
- uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2.0.0
15+
with:
16+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr_pre-commit.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: pre-commit
3+
4+
on:
5+
pull_request:
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
RUST_TOOLCHAIN_VERSION: "1.82.0"
10+
HADOLINT_VERSION: "v1.17.6"
11+
12+
jobs:
13+
pre-commit:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
17+
with:
18+
fetch-depth: 0
19+
- uses: stackabletech/actions/run-pre-commit@9bd13255f286e4b7a654617268abe1b2f37c3e0a # v0.3.0
20+
with:
21+
rust: ${{ env.RUST_TOOLCHAIN_VERSION }}
22+
# rust-src is required for trybuild stderr output comparison to work
23+
# for our cases.
24+
# See: https://github.com/dtolnay/trybuild/issues/236#issuecomment-1620950759
25+
rust-components: rustfmt,clippy,rust-src

.pre-commit-config.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
default_language_version:
3+
node: system
4+
5+
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # 4.6.0
8+
hooks:
9+
- id: trailing-whitespace
10+
- id: end-of-file-fixer
11+
- id: detect-aws-credentials
12+
args: ["--allow-missing-credentials"]
13+
- id: detect-private-key
14+
15+
- repo: https://github.com/doublify/pre-commit-rust
16+
rev: eeee35a89e69d5772bdee97db1a6a898467b686e # 1.0
17+
hooks:
18+
- id: fmt
19+
args: ["--all", "--", "--check"]
20+
- id: clippy
21+
args: ["--all-targets", "--", "-D", "warnings"]
22+
- repo: https://github.com/adrienverge/yamllint
23+
rev: 81e9f98ffd059efe8aa9c1b1a42e5cce61b640c6 # 1.35.1
24+
hooks:
25+
- id: yamllint
26+
27+
- repo: https://github.com/igorshubovych/markdownlint-cli
28+
rev: f295829140d25717bc79368d3f966fc1f67a824f # 0.41.0
29+
hooks:
30+
- id: markdownlint
31+
32+
- repo: https://github.com/koalaman/shellcheck-precommit
33+
rev: 2491238703a5d3415bb2b7ff11388bf775372f29 # 0.10.0
34+
hooks:
35+
- id: shellcheck
36+
args: ["--severity=info"]
37+
38+
- repo: https://github.com/rhysd/actionlint
39+
rev: 62dc61a45fc95efe8c800af7a557ab0b9165d63b # 1.7.1
40+
hooks:
41+
- id: actionlint
42+
43+
- repo: https://github.com/hadolint/hadolint
44+
rev: b3555ba9c2bfd9401e79f2f0da68dd1ae38e10c7 # 2.12.0
45+
hooks:
46+
- id: hadolint

0 commit comments

Comments
 (0)