Skip to content

Commit 54041b4

Browse files
authored
Merge release v0.1.0 to main
Release v0.1.0
2 parents eaaeaea + f018ccf commit 54041b4

File tree

117 files changed

+19790
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+19790
-1
lines changed

.github/workflows/ci.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
test:
14+
name: Test
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, windows-latest, macos-latest]
19+
rust: [stable, beta]
20+
exclude:
21+
# Reduce CI load - only test beta on Ubuntu
22+
- os: windows-latest
23+
rust: beta
24+
- os: macos-latest
25+
rust: beta
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Install Rust
31+
uses: dtolnay/rust-toolchain@master
32+
with:
33+
toolchain: ${{ matrix.rust }}
34+
components: rustfmt, clippy
35+
36+
- name: Cache cargo registry
37+
uses: actions/cache@v3
38+
with:
39+
path: |
40+
~/.cargo/registry
41+
~/.cargo/git
42+
target
43+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
44+
45+
- name: Check formatting
46+
run: cargo fmt --all -- --check
47+
48+
- name: Run clippy
49+
run: cargo clippy --all-targets --all-features -- -D warnings
50+
51+
- name: Build
52+
run: cargo build --verbose
53+
54+
- name: Run tests
55+
run: cargo test --verbose
56+
57+
- name: Run doc tests
58+
run: cargo test --doc
59+
60+
coverage:
61+
name: Coverage
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@v4
65+
66+
- name: Install Rust
67+
uses: dtolnay/rust-toolchain@stable
68+
with:
69+
components: llvm-tools-preview
70+
71+
- name: Install cargo-llvm-cov
72+
uses: taiki-e/install-action@cargo-llvm-cov
73+
74+
- name: Generate code coverage
75+
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
76+
77+
- name: Upload coverage to Codecov
78+
uses: codecov/codecov-action@v3
79+
with:
80+
files: lcov.info
81+
fail_ci_if_error: true
82+
83+
security:
84+
name: Security Audit
85+
runs-on: ubuntu-latest
86+
steps:
87+
- uses: actions/checkout@v4
88+
89+
- name: Install cargo-audit
90+
uses: taiki-e/install-action@cargo-audit
91+
92+
- name: Run security audit
93+
run: cargo audit

.github/workflows/docs.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Install Rust
24+
uses: dtolnay/rust-toolchain@stable
25+
26+
- name: Cache cargo registry
27+
uses: actions/cache@v3
28+
with:
29+
path: |
30+
~/.cargo/registry
31+
~/.cargo/git
32+
target
33+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
34+
35+
- name: Build Documentation
36+
run: cargo doc --no-deps --workspace --document-private-items
37+
38+
- name: Setup Pages
39+
uses: actions/configure-pages@v4
40+
41+
- name: Upload artifact
42+
uses: actions/upload-pages-artifact@v3
43+
with:
44+
path: ./target/doc
45+
46+
deploy:
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
runs-on: ubuntu-latest
51+
needs: build
52+
steps:
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
create-release:
13+
name: Create Release
14+
runs-on: ubuntu-latest
15+
outputs:
16+
upload_url: ${{ steps.create_release.outputs.upload_url }}
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
- name: Update CHANGELOG.md
24+
uses: orhun/git-cliff-action@v2
25+
with:
26+
args: --latest --prepend CHANGELOG.md
27+
version: ${{ github.ref_name }}
28+
git-commit: true
29+
git-push: true
30+
git-commit-message: "chore: update changelog for ${{ github.ref_name }}"
31+
git-user-name: "github-actions[bot]"
32+
git-user-email: "github-actions[bot]@users.noreply.github.com"
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
- name: Determine if prerelease
36+
run: |
37+
if [[ "${{ github.ref_name }}" == *"-"* ]]; then
38+
echo "prerelease=true" >> $GITHUB_ENV
39+
else
40+
echo "prerelease=false" >> $GITHUB_ENV
41+
fi
42+
- name: Create Release
43+
id: create_release
44+
uses: actions/create-release@v1
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
with:
48+
tag_name: ${{ github.ref_name }}
49+
release_name: Release ${{ github.ref_name }}
50+
draft: false
51+
prerelease: ${{ env.prerelease }}
52+
53+
build-release:
54+
name: Build Release
55+
needs: create-release
56+
runs-on: ${{ matrix.os }}
57+
strategy:
58+
matrix:
59+
include:
60+
- os: ubuntu-latest
61+
target: x86_64-unknown-linux-gnu
62+
suffix: ""
63+
- os: windows-latest
64+
target: x86_64-pc-windows-msvc
65+
suffix: ".exe"
66+
- os: macos-latest
67+
target: x86_64-apple-darwin
68+
suffix: ""
69+
- os: macos-latest
70+
target: aarch64-apple-darwin
71+
suffix: ""
72+
73+
steps:
74+
- uses: actions/checkout@v4
75+
76+
- name: Install Rust
77+
uses: dtolnay/rust-toolchain@stable
78+
with:
79+
targets: ${{ matrix.target }}
80+
81+
- name: Cache cargo registry
82+
uses: actions/cache@v3
83+
with:
84+
path: |
85+
~/.cargo/registry
86+
~/.cargo/git
87+
target
88+
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
89+
90+
- name: Build release binary
91+
run: cargo build --release --target ${{ matrix.target }}
92+
93+
- name: Create archive
94+
shell: bash
95+
run: |
96+
binary_name="code-guardian-cli${{ matrix.suffix }}"
97+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
98+
archive_name="code-guardian-${{ matrix.target }}.zip"
99+
cp "target/${{ matrix.target }}/release/${binary_name}" .
100+
7z a "${archive_name}" "${binary_name}" README.md
101+
else
102+
archive_name="code-guardian-${{ matrix.target }}.tar.gz"
103+
cp "target/${{ matrix.target }}/release/${binary_name}" .
104+
tar czf "${archive_name}" "${binary_name}" README.md
105+
fi
106+
echo "ARCHIVE_NAME=${archive_name}" >> $GITHUB_ENV
107+
108+
- name: Upload Release Asset
109+
uses: actions/upload-release-asset@v1
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
with:
113+
upload_url: ${{ needs.create-release.outputs.upload_url }}
114+
asset_path: ./${{ env.ARCHIVE_NAME }}
115+
asset_name: ${{ env.ARCHIVE_NAME }}
116+
asset_content_type: application/octet-stream

.gitignore

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Generated by Cargo
22
# will have compiled files and executables
3+
/target
34
debug
4-
target
55

66
# These are backup files generated by rustfmt
77
**/*.rs.bk
@@ -19,3 +19,15 @@ target
1919
# and can be added to the global gitignore or merged into this file. For a more nuclear
2020
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
2121
#.idea/
22+
23+
# Database files
24+
*.db
25+
26+
# Environment files
27+
.env
28+
29+
# node.js
30+
node_modules
31+
32+
# Archived plans
33+
/plans/archive

.opencode/.eslintrc.cjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
extends: [
4+
'eslint:recommended',
5+
'plugin:@typescript-eslint/recommended',
6+
],
7+
plugins: ['@typescript-eslint'],
8+
env: {
9+
node: true,
10+
es6: true,
11+
jest: true,
12+
},
13+
rules: {
14+
// Add any custom rules here
15+
},
16+
};

.opencode/.github/workflows/ci.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
ci:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
rust: [stable]
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
path: code-guardian
20+
- name: Setup Rust
21+
uses: dtolnay/rust-toolchain@stable
22+
- name: Cache dependencies
23+
uses: actions/cache@v3
24+
with:
25+
path: |
26+
~/.cargo/registry
27+
~/.cargo/git
28+
code-guardian/target
29+
key: ${{ runner.os }}-cargo-${{ hashFiles('code-guardian/Cargo.lock') }}
30+
restore-keys: |
31+
${{ runner.os }}-cargo-
32+
- name: Check
33+
run: cargo check --workspace
34+
working-directory: code-guardian
35+
- name: Test
36+
run: cargo test --workspace
37+
working-directory: code-guardian
38+
- name: Clippy
39+
run: cargo clippy --workspace -- -D warnings
40+
working-directory: code-guardian
41+
- name: Format
42+
run: cargo fmt --all -- --check
43+
working-directory: code-guardian
44+
- name: Build release
45+
run: cargo build --release --workspace
46+
working-directory: code-guardian
47+
- name: Upload binaries
48+
uses: actions/upload-artifact@v3
49+
with:
50+
name: binaries-${{ matrix.os }}
51+
path: code-guardian/target/release/

0 commit comments

Comments
 (0)