Files
waozi 09cd516a75 Retire the GitHub deploy path and its origin key tooling
The GitHub mirror's deploy and origin-identity workflows logged in to the
production origin as root with an unrestricted key. That key is removed
from the origin and the workflows are disabled, so their files and the
bootstrap scripts only they used are deleted. Gitea's forced-command
deploy is the only path, and the workflow test now refuses a GitHub
deploy workflow. The deployment-input test checks the Gitea workflow.
2026-11-23 01:59:35 -03:00

169 lines
6.0 KiB
YAML

name: ci
on:
workflow_call:
permissions:
contents: read
concurrency:
group: mesh-ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-policy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
submodules: recursive
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: "1.26.x"
- name: Test Mesh migration and site
run: |
mkdir -p build/test-tmp
TMPDIR="$PWD/build/test-tmp" python3 -m unittest discover -s scripts -p 'test_mesh*.py'
python3 -B scripts/test_migrate_env.py
python3 -B scripts/test_provision_mesh_site.py
- name: Validate workflow permissions and dependencies
run: |
go run github.com/rhysd/actionlint/cmd/[email protected]
shellcheck deploy/install.sh deploy/rollback.sh
- name: Verify immutable build and deployment policy
run: |
python3 -B scripts/verify_build_inputs.py
python3 -B scripts/test_build_inputs.py
python3 -B scripts/test_check_sarif.py
python3 -B scripts/test_deployment_inputs.py
python3 -B scripts/test_deploy_install.py
python3 -B scripts/test_migrate_env.py
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
submodules: recursive
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: "1.26.x"
cache: true
- name: Generate the Go from the Zi sources
uses: ./.github/actions/generate
- name: Build the vendored liboqs
uses: ./.github/actions/liboqs
- name: Install golangci-lint
env:
GOLANGCI_LINT_VERSION: "2.14.0"
GOLANGCI_LINT_SHA256: "ab90aeb7b066f92a33415b638a50fe5344bbb75a0d32ad30cc248d88f81032ab"
run: |
curl --fail --location --silent --show-error \
--output "$RUNNER_TEMP/golangci-lint.tar.gz" \
"https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz"
printf '%s %s\n' "$GOLANGCI_LINT_SHA256" "$RUNNER_TEMP/golangci-lint.tar.gz" | sha256sum --check --strict
tar --extract --gzip --file "$RUNNER_TEMP/golangci-lint.tar.gz" --directory "$RUNNER_TEMP"
install -m 0755 "$RUNNER_TEMP/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint" /usr/local/bin/golangci-lint
- name: Lint
run: golangci-lint run --timeout=5m
env:
CGO_ENABLED: "1"
GOFLAGS: "-mod=mod"
CGO_CFLAGS: "-I${{ github.workspace }}/build/liboqs/install/include"
CGO_LDFLAGS: "-L${{ github.workspace }}/build/liboqs/install/lib -loqs"
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.26.x"]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
submodules: recursive
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: ${{ matrix.go-version }}
cache: true
- name: Generate the Go from the Zi sources
uses: ./.github/actions/generate
- name: Build the vendored liboqs
uses: ./.github/actions/liboqs
- name: Check formatting
run: test -z "$(git ls-files -z '*.go' | xargs -0 gofmt -l)"
- name: Check generated diff hygiene
run: git diff --check
- name: Test
run: make test
- name: Race test
run: make test GOFLAGS="-mod=mod -race"
- name: Report coverage
if: matrix.go-version == '1.26.x'
run: |
make test TEST_FLAGS="-coverprofile=coverage.out"
go tool cover -func=coverage.out | tail -1
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
submodules: recursive
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version: "1.26"
- name: Generate the Go from the Zi sources
uses: ./.github/actions/generate
- name: Build container image
run: docker build --pull --build-arg VERSION=ci-${{ github.sha }} -t mesh:ci .
- name: Verify container starts as a non-root user
env:
EXPECTED_VERSION: ci-${{ github.sha }}
run: |
MESH_TOKEN_SECRET_HEX=$(python3 -c 'import secrets; print(secrets.token_hex(32))')
export MESH_TOKEN_SECRET_HEX
container=$(docker run -d --read-only --tmpfs /data:uid=65532,gid=65532,mode=0700 -e MESH_TOKEN_SECRET_HEX -e MESH_DB=/data/test.db -e MESH_ADDR=:8080 -p 127.0.0.1::8080 mesh:ci)
trap 'docker logs "$container"; docker rm -f "$container"' EXIT
test "$(docker inspect --format '{{.Config.User}}' "$container")" = '65532:65532'
port=$(docker port "$container" 8080/tcp)
export CONTAINER_URL="http://$port"
python3 - <<'PY'
import json
import os
import time
import urllib.error
import urllib.request
base = os.environ['CONTAINER_URL']
for attempt in range(60):
try:
with urllib.request.urlopen(base + '/readyz', timeout=2) as response:
if response.status == 200:
break
except (urllib.error.URLError, TimeoutError):
pass
time.sleep(1)
else:
raise SystemExit('container did not become ready')
with urllib.request.urlopen(base + '/api/v1/node', timeout=2) as response:
node = json.load(response)
assert node['build_version'] == os.environ['EXPECTED_VERSION'], node
PY