Files
frislit/.gitea/workflows/ci.yml
T
fristy e302e80cc9
CI / Docker image (pull_request) Successful in 13s
CI / CLI (pull_request) Successful in 15s
CI / Server (pull_request) Successful in 26s
CI / CLI (windows) (pull_request) Successful in 2m3s
CI / CLI (linux-arm64, static) (pull_request) Successful in 2m30s
ci: cache the Windows cargo build and check arm64 in debug
Add the cargo cache to the CI Windows job and the release Windows CLI job, and build the arm64 CLI in debug mode for CI so the matrix job stops dominating the run.
2026-11-11 17:48:42 +03:00

162 lines
4.6 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
cli/target
key: ${{ runner.os }}-cargo-check-${{ hashFiles('cli/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-check-
- 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: 45
continue-on-error: true
steps:
- uses: actions/checkout@v7
- name: Cache cargo
uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
cli/target
key: ${{ runner.os }}-cargo-arm64-check-${{ hashFiles('cli/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-arm64-check-
- name: Cross-compile for arm64
working-directory: cli
run: cargo zigbuild --target aarch64-unknown-linux-musl --no-default-features