Skip to content

Commit

Permalink
chore: try this
Browse files Browse the repository at this point in the history
Signed-off-by: jlanson <[email protected]>
  • Loading branch information
j-lanson committed Feb 24, 2025
1 parent 0815dae commit 83e09f0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 30 deletions.
57 changes: 27 additions & 30 deletions .github/workflows/hipcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,7 @@ env:
CARGO_TERM_COLOR: always

jobs:
# job to run change detection
changes:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
code: ${{ steps.filter.outputs.code }}
steps:
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- "config/**"
- "hipcheck/**"
- "plugins/**"
- "xtask/**"
- "sdk/rust/**"
- "hipcheck-common/**"
- "hipcheck-macros/**"
- "hipcheck-sdk-macros/**"
- 'backend/**'
test:
needs: changes
if: ${{ needs.changes.outputs.code == 'true' }}
strategy:
matrix:
# NOTE: this list of runners is manually synced with the set used by
Expand All @@ -72,51 +45,75 @@ jobs:
steps:
# Get the repo, get Rust, get `cargo-nextest`, setup caching.
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
code:
- "config/**"
- "hipcheck/**"
- "plugins/**"
- "xtask/**"
- "sdk/rust/**"
- "hipcheck-common/**"
- "hipcheck-macros/**"
- "hipcheck-sdk-macros/**"
- uses: dtolnay/rust-toolchain@stable
if: steps.filter.outputs.code == 'true'
- uses: taiki-e/install-action@nextest
if: steps.filter.outputs.code == 'true'
- uses: swatinem/rust-cache@v2
if: steps.filter.outputs.code == 'true'
with:
key: ${{ matrix.os }}

# Install the protobuf compiler
- if: runner.os == 'Linux'
- if: runner.os == 'Linux' && steps.filter.outputs.code == 'true'
run: sudo apt-get install -y protobuf-compiler
- if: runner.os == 'macOS'
- if: runner.os == 'macOS' && steps.filter.outputs.code == 'true'
run: brew install protobuf
- if: runner.os == 'Windows'
- if: runner.os == 'Windows' && steps.filter.outputs.code == 'true'
run: choco install protoc

# Print dependency info (useful for debugging)
- name: Dependency Tree
if: steps.filter.outputs.code == 'true'
run: cargo tree

# Try building every crate in the workspace, without debug symbols to
# hopefully reduce build times
- name: Build
if: steps.filter.outputs.code == 'true'
run: cargo build --verbose --workspace

# Test the code.
- name: Test
if: steps.filter.outputs.code == 'true'
run: cargo nextest r --verbose --workspace

# Run the linter.
- name: Lint
if: steps.filter.outputs.code == 'true'
run: cargo clippy --verbose --workspace

# Run our own checks for licensing and other info.
- name: Check
if: steps.filter.outputs.code == 'true'
run: cargo xtask check

# Run a few variants of Hipcheck
- name: Run with Policy
if: steps.filter.outputs.code == 'true'
env:
HC_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./target/debug/hc --policy ./config/Hipcheck.kdl check https://github.com/mitre/hipcheck
- name: Run with Local Policy
if: steps.filter.outputs.code == 'true'
env:
HC_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./target/debug/hc --policy ./config/local.Hipcheck.kdl check https://github.com/mitre/hipcheck
- name: Run with Config
if: steps.filter.outputs.code == 'true'
env:
HC_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./target/debug/hc --config ./config check https://github.com/mitre/hipcheck
12 changes: 12 additions & 0 deletions .github/workflows/website-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,24 @@ jobs:
- name: Checkout Hipcheck Repository
uses: actions/checkout@v4

# Check if any site changes and skip future steps if not
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
site:
- "site/**"
# Install the latest version of Zola.
- name: Install Zola
if: steps.filter.outputs.site == 'true'
uses: taiki-e/install-action@v2
with:
tool: [email protected]

# Install the latest version of the Tailwind CLI.
- name: Install Tailwind CLI
if: steps.filter.outputs.site == 'true'
run: |
curl --proto '=https' --tlsv1.2 -sSLO https://github.com/tailwindlabs/tailwindcss/releases/download/v${TAILWIND_VERSION}/tailwindcss-linux-x64
chmod +x tailwindcss-linux-x64
Expand All @@ -64,12 +74,14 @@ jobs:
# Install the latest major version of Deno.
- name: Install Deno
if: steps.filter.outputs.site == 'true'
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

# Build the actual site with Zola and Tailwind.
- name: Build Hipcheck Website
if: steps.filter.outputs.site == 'true'
run: |
cd site
zola build
Expand Down

0 comments on commit 83e09f0

Please sign in to comment.