Files
EvoBGP/.gitea/workflows/ci.yaml
T
Denozordec eddc6b85a0
CI / changes (push) Successful in 5s
CI / go (push) Successful in 19s
CI / openapi (push) Has been skipped
CI / bird2 (push) Failing after 16s
ci: update README and CI workflow to improve bird2 job installation process and clarify Docker usage
2026-04-04 01:37:44 +07:00

114 lines
3.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: CI
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
jobs:
changes:
runs-on: ubuntu-latest
outputs:
openapi: ${{ steps.openapi.outputs.changed }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: openapi
name: Detect OpenAPI-related file changes
run: |
set -euo pipefail
PATHS="docs/openapi.yaml redocly.yaml"
changed=false
if [ "${{ github.event_name }}" = "pull_request" ]; then
base="${{ github.event.pull_request.base.sha }}"
head="${{ github.event.pull_request.head.sha }}"
if git diff --name-only "$base" "$head" -- $PATHS | grep -q .; then
changed=true
fi
else
before="${{ github.event.before }}"
after="${{ github.sha }}"
if [ -n "$before" ] && [ "$before" != "0000000000000000000000000000000000000000" ]; then
if git diff --name-only "$before" "$after" -- $PATHS | grep -q .; then
changed=true
fi
elif git rev-parse --verify HEAD~1 >/dev/null 2>&1; then
if git diff --name-only HEAD~1 HEAD -- $PATHS | grep -q .; then
changed=true
fi
else
# Нет родителя (первый коммит / тонкий clone) — линт OpenAPI выполняем один раз
changed=true
fi
fi
echo "changed=$changed" >> "$GITHUB_OUTPUT"
echo "OpenAPI lint will run: $changed"
openapi:
needs: [changes]
if: needs.changes.outputs.openapi == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Lint OpenAPI (Redocly)
run: npx --yes @redocly/cli@1 lint docs/openapi.yaml
go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Vet
run: go vet ./...
- name: Test
run: go test ./... -race -count=1
- name: Build all commands
run: |
set -euxo pipefail
out="${RUNNER_TEMP}/evobgp-bin"
mkdir -p "$out"
for d in cmd/*/; do
name="$(basename "$d")"
go build -o "$out/$name" "./$d"
done
bird2:
runs-on: ubuntu-latest
needs: [go]
steps:
- uses: actions/checkout@v4
# Вложенный docker + bind-mount ломается, если демон Docker на хосте не видит путь
# workspace runner'а (/workspace/...). bird -p на самом job-раннере надёжнее.
- name: Install bird2
run: |
set -euxo pipefail
if command -v sudo >/dev/null 2>&1; then SUDO=sudo; else SUDO=""; fi
$SUDO apt-get update -qq
DEBIAN_FRONTEND=noninteractive $SUDO apt-get install -y -qq bird2
bird --version
- name: bird -p on all scenario bird.conf files
env:
WORKSPACE: ${{ github.workspace }}
run: |
set -euxo pipefail
WS="${WORKSPACE:-$PWD}"
cd "$WS"
if [ ! -f internal/birdfmt/testdata/scenarios/minimal/bird.conf ]; then
echo "Нет сценариев BIRD в checkout. Проверьте, что internal/birdfmt/testdata/scenarios закоммичен и push в remote."
ls -la internal/birdfmt/testdata/ 2>/dev/null || ls -la
exit 1
fi
for conf in internal/birdfmt/testdata/scenarios/*/bird.conf; do
echo "==> $conf"
bird -c "$WS/$conf" -p
done