Files
frislit/.gitea/workflows/ci.yml
T
fristy d6ab83fc2e
CI / Docker image (pull_request) Successful in 17s
CI / CLI (pull_request) Successful in 18s
CI / Server (pull_request) Successful in 25s
CI / CLI (windows) (pull_request) Successful in 3m6s
CI / CLI (linux-arm64, static) (pull_request) Successful in 5m38s
fix(release): build the Linux CLI against musl
The x86-64 artifact was built on the 26.10 runner image and required glibc 2.44,
so it failed on older distributions. Build both Linux targets statically with
the image's zig toolchain and fail the job when the result is not static.
2026-11-17 16:06:00 +03:00

168 lines
4.8 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: 60
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: Add the static Linux targets
run: rustup target add x86_64-unknown-linux-musl
- name: Cross-compile for arm64
working-directory: cli
run: cargo zigbuild --target aarch64-unknown-linux-musl --no-default-features
- name: Cross-compile for x86-64
working-directory: cli
run: cargo zigbuild --target x86_64-unknown-linux-musl