Skip to content

Commit e208d8b

Browse files
authored
Merge pull request #34 from 0xarchit/feature/codeql-advanced
feat: Implement Advanced CodeQL Security Analysis with Native Rust Support
2 parents d94b876 + faafa6f commit e208d8b

2 files changed

Lines changed: 101 additions & 5 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: "CodeQL Advanced"
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: '8 5 * * 0'
10+
11+
permissions:
12+
security-events: write
13+
contents: read
14+
pull-requests: read
15+
actions: read
16+
packages: read
17+
18+
jobs:
19+
detect-changes:
20+
name: Detect Changed Languages
21+
runs-on: ubuntu-latest
22+
outputs:
23+
languages: ${{ steps.set-languages.outputs.languages }}
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
27+
28+
- name: Filter Paths
29+
id: filter
30+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
31+
with:
32+
filters: |
33+
rust:
34+
- 'src/**'
35+
- 'Cargo.toml'
36+
- 'Cargo.lock'
37+
- '**/*.rs'
38+
actions:
39+
- '.github/workflows/**'
40+
41+
- name: Set Language Matrix
42+
id: set-languages
43+
run: |
44+
langs=()
45+
46+
if [[ "${{ github.event_name }}" == "schedule" || "${{ steps.filter.outputs.rust }}" == "true" ]]; then
47+
langs+=('"rust"')
48+
fi
49+
50+
if [[ "${{ github.event_name }}" == "schedule" || "${{ steps.filter.outputs.actions }}" == "true" ]]; then
51+
langs+=('"actions"')
52+
fi
53+
54+
json_array="[$(IFS=,; echo "${langs[*]}")]"
55+
echo "languages=$json_array" >> $GITHUB_OUTPUT
56+
57+
analyze:
58+
name: Analyze
59+
needs: detect-changes
60+
if: ${{ needs.detect-changes.outputs.languages != '[]' }}
61+
runs-on: windows-latest
62+
63+
strategy:
64+
fail-fast: false
65+
matrix:
66+
language: ${{ fromJSON(needs.detect-changes.outputs.languages) }}
67+
68+
steps:
69+
- name: Checkout repository
70+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
71+
72+
- name: Initialize CodeQL
73+
uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7
74+
with:
75+
languages: ${{ matrix.language }}
76+
queries: security-extended,security-and-quality
77+
config: |
78+
threat-models: remote
79+
80+
- name: Install Rust Toolchain
81+
if: matrix.language == 'rust'
82+
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
83+
84+
- name: Build Production Code
85+
if: matrix.language == 'rust'
86+
run: |
87+
$env:RUSTFLAGS="-C link-arg=/OPT:REF -C link-arg=/OPT:ICF"
88+
cargo build --release
89+
90+
- name: Autobuild
91+
if: matrix.language != 'rust'
92+
uses: github/codeql-action/autobuild@e46ed2cbd01164d986452f91f178727624ae40d7
93+
94+
- name: Perform CodeQL Analysis
95+
uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7
96+
with:
97+
category: "/language:${{matrix.language}}"

.github/workflows/release.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,18 @@ jobs:
1313
contents: write
1414

1515
steps:
16-
1716
- name: Checkout Code
18-
uses: actions/checkout@v4
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
1918

2019
- name: Install Rust
21-
uses: dtolnay/rust-toolchain@stable
20+
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
2221

2322
- name: Install WiX
2423
run: dotnet tool install --global wix
2524

2625
- name: Install WiX Extensions
2726
run: |
28-
wix eula accept wix7
27+
wix eula accept
2928
wix extension add -g WixToolset.UI.wixext
3029
wix extension add -g WixToolset.Util.wixext
3130
@@ -39,7 +38,7 @@ jobs:
3938
wix build wix/main.wxs -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext -o target/release/PauseCat_Installer.msi
4039
4140
- name: Upload Release Artifacts
42-
uses: softprops/action-gh-release@v1
41+
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191
4342
with:
4443
files: |
4544
target/release/PauseCat_Installer.msi

0 commit comments

Comments
 (0)