Files
fristy 962320f553
CI / Docker image (pull_request) Successful in 15s
CI / CLI (pull_request) Successful in 15s
CI / Server (pull_request) Successful in 25s
CI / CLI (linux-arm64, static) (pull_request) Successful in 1m44s
CI / CLI (windows) (pull_request) Successful in 2m8s
CI / CLI (linux-x86-64, static) (pull_request) Successful in 3m32s
ci: give each static Linux target its own cache and job
Both checks rebuilt from scratch every run: the arm64 key already existed, so
the cache was never saved. Cache per target, build without debug info, check
x86-64 in its own job, and stop caching cli/target on Windows.
2026-11-17 16:44:19 +03:00

194 lines
5.5 KiB
YAML

name: CI
on:
push:
branches: [main]
pull_request:
jobs:
server:
name: Server
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- name: Cache npm
uses: actions/cache@v6
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json', 'client/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Install server dependencies
run: npm ci --no-audit --no-fund
- name: Build the web interface
run: |
npm ci --no-audit --no-fund --prefix client
npm run build --prefix client
- name: Lint the web interface
run: npm run lint --prefix client
- name: Test the server
run: npm test
cli:
name: CLI
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- name: Cache cargo
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
cli/target
key: ${{ runner.os }}-cargo-check-${{ hashFiles('cli/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-check-
- name: Check the CLI
run: cargo check --manifest-path cli/Cargo.toml
cli-windows:
name: CLI (windows)
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- name: Cache cargo
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('cli/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Install Rust
shell: powershell
run: |
if (Get-Command rustup -ErrorAction SilentlyContinue) {
rustup show active-toolchain
} else {
Invoke-WebRequest https://win.rustup.rs/x86_64 -OutFile rustup-init.exe -UseBasicParsing
./rustup-init.exe -y --default-toolchain stable --profile minimal
"$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
}
- name: Report the toolchain
shell: powershell
run: |
rustc --version
cargo --version
dotnet --version 2>$null
if (Get-Command wix -ErrorAction SilentlyContinue) { wix --version }
- name: Put Git Bash on PATH
shell: powershell
run: |
"C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
"C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Check that bash works
shell: bash
run: |
bash --version | head -1
sed --version | head -1
echo "bash-and-sed-ok"
- name: Check the CLI on Windows
shell: powershell
run: cargo check --manifest-path cli/Cargo.toml
docker:
name: Docker image
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- name: Build the image
run: docker build -t frislit:ci .
- name: Scan the image
run: |
trivy image --quiet --format json --severity HIGH,CRITICAL --ignore-unfixed \
--output report.json frislit:ci
jq -r '.Results[]?.Vulnerabilities[]? | "\(.Severity) \(.VulnerabilityID) \(.PkgName) \(.InstalledVersion)"' report.json \
| sort | uniq -c | sort -rn | head -40
high=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "HIGH")] | length' report.json)
critical=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "CRITICAL")] | length' report.json)
echo "HIGH=$high CRITICAL=$critical (unfixed findings ignored)"
if [ "$critical" -gt 0 ]; then
echo "::error::The image has $critical CRITICAL vulnerabilities"
exit 1
fi
cli-arm64:
name: CLI (linux-arm64, static)
runs-on: ubuntu-latest
timeout-minutes: 60
env:
CARGO_PROFILE_DEV_DEBUG: "0"
steps:
- uses: actions/checkout@v7
- name: Cache cargo
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
cli/target/debug
cli/target/aarch64-unknown-linux-musl
key: ${{ runner.os }}-cargo-arm64-check-${{ hashFiles('cli/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-arm64-check-
- name: Add the arm64 target
run: rustup target add aarch64-unknown-linux-musl
- name: Cross-compile for arm64
working-directory: cli
run: cargo zigbuild --target aarch64-unknown-linux-musl --no-default-features
cli-x86-64:
name: CLI (linux-x86-64, static)
runs-on: ubuntu-latest
timeout-minutes: 60
env:
CARGO_PROFILE_DEV_DEBUG: "0"
steps:
- uses: actions/checkout@v7
- name: Cache cargo
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
cli/target/debug
cli/target/x86_64-unknown-linux-musl
key: ${{ runner.os }}-cargo-x86-64-check-${{ hashFiles('cli/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-x86-64-check-
- name: Add the x86-64 target
run: rustup target add x86_64-unknown-linux-musl
- name: Cross-compile for x86-64
working-directory: cli
run: cargo zigbuild --target x86_64-unknown-linux-musl