| 1 |
name: CI |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [main] |
| 6 |
pull_request: |
| 7 |
branches: [main] |
| 8 |
|
| 9 |
jobs: |
| 10 |
check: |
| 11 |
runs-on: ubuntu-latest |
| 12 |
steps: |
| 13 |
- uses: actions/checkout@v5 |
| 14 |
|
| 15 |
- uses: actions/setup-go@v6 |
| 16 |
with: |
| 17 |
go-version-file: go.mod |
| 18 |
|
| 19 |
- name: Install actionlint |
| 20 |
run: go install github.com/rhysd/actionlint/cmd/[email protected] |
| 21 |
|
| 22 |
- name: Install golangci-lint |
| 23 |
run: go install github.com/golangci/golangci-lint/v2/cmd/[email protected] |
| 24 |
|
| 25 |
- name: Install Hugo |
| 26 |
run: go install github.com/gohugoio/[email protected] |
| 27 |
|
| 28 |
- name: Add local user bin to PATH |
| 29 |
run: echo "$HOME/.local/bin" >> "$GITHUB_PATH" |
| 30 |
|
| 31 |
- name: Install system tools |
| 32 |
run: sudo apt-get update && sudo apt-get install -y cloc pandoc |
| 33 |
|
| 34 |
- name: Install clankerval release package |
| 35 |
env: |
| 36 |
DEBIAN_FRONTEND: noninteractive |
| 37 |
GH_TOKEN: ${{ github.token }} |
| 38 |
run: | |
| 39 |
version="$(sed -n 's/^CLANKERVAL_PINNED_VERSION := //p' Makefile)" |
| 40 |
arch="$(dpkg --print-architecture)" |
| 41 |
pattern="clankerval_${version}-*_${arch}.deb" |
| 42 |
gh release download "v${version}" --repo clnkr-ai/clankerval --pattern "$pattern" |
| 43 |
deb="$(find . -maxdepth 1 -name "$pattern" -print -quit)" |
| 44 |
sudo apt-get update |
| 45 |
sudo apt-get install -y "$deb" |
| 46 |
rm -f "$deb" |
| 47 |
|
| 48 |
- name: Check |
| 49 |
run: | |
| 50 |
"$(go env GOPATH)/bin/actionlint" |
| 51 |
make check |
| 52 |
|
| 53 |
- name: Race tests |
| 54 |
run: go test -race ./... -v |
| 55 |
|
| 56 |
guardrails: |
| 57 |
runs-on: ubuntu-latest |
| 58 |
env: |
| 59 |
ARCHITECTURE_RELEASE_TAG: architecture-guardrail-bin-0.5.2 |
| 60 |
ARCHITECTURE_SHA256: 9168a0ba9ceeb6d556bc42c800b0435ef43b4a9f9b5c1a631b583e79a180c8df |
| 61 |
steps: |
| 62 |
- uses: actions/checkout@v5 |
| 63 |
|
| 64 |
- name: Install architecture guardrail binary |
| 65 |
env: |
| 66 |
GH_TOKEN: ${{ github.token }} |
| 67 |
run: | |
| 68 |
mkdir -p build/tools |
| 69 |
gh release download "$ARCHITECTURE_RELEASE_TAG" \ |
| 70 |
--repo clnkr-ai/clnkr \ |
| 71 |
--pattern architecture-linux-amd64 \ |
| 72 |
--dir build/tools |
| 73 |
echo "$ARCHITECTURE_SHA256 build/tools/architecture-linux-amd64" | sha256sum -c - |
| 74 |
chmod +x build/tools/architecture-linux-amd64 |
| 75 |
build/tools/architecture-linux-amd64 --help |
| 76 |
echo "THOTH_BIN=$PWD/build/tools/architecture-linux-amd64" >> "$GITHUB_ENV" |
| 77 |
|
| 78 |
- name: Run guardrail reports |
| 79 |
run: | |
| 80 |
make thoth-critical-check |
| 81 |
make architecture-shape-report |
| 82 |
make semantic-cohesion-report |
| 83 |
make test-fidelity-report |