Skip to content

Commit

Permalink
CI/CD skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
wzslr321 committed Oct 3, 2024
1 parent e69a215 commit 0a330e9
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/impactifier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Impactifier CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
impactifier:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set Up Rust
uses: actions/setup-rust@v1
with:
rust-version: stable

- name: Cache Cargo Registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo Build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-build-
- name: Build Impactifier
run: |
cargo build --release --manifest-path Cargo.toml
- name: Run Impactifier
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
./target/release/impactifier --config impactifier-config.yaml
# - name: Upload Report
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: impactifier-report
# path: ./reports/

- name: Post Comment on Pull Request
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## Impactifier Report`
});
20 changes: 20 additions & 0 deletions impactifier-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
rules:
- name: "Detect API Changes"
trigger:
path: "api/"
pattern: "func (\\w+)Handler"
analyze_dependencies: true
transform:
name: "toApiEndpoint"
steps:
- toLowerCase
- replace:
pattern: "Handler$"
with: "_endpoint"
- prepend: "/api/"
match:
path: "client/"
pattern: "ApiClient.call('$transform')"
action:
alert_level: "Severe"
message: "API changed"

0 comments on commit 0a330e9

Please sign in to comment.