z2k/.github/workflows/ci.yml
Necronicle e3b794dd74
Some checks are pending
CI / ShellCheck (push) Waiting to run
CI / Go Build & Test (push) Waiting to run
CI / Luacheck (push) Waiting to run
tg tunnel: backport keepalive and relay fixes
2026-04-22 00:17:23 +03:00

102 lines
2.9 KiB
YAML

name: CI
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
shellcheck:
name: ShellCheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install shellcheck
run: sudo apt-get update && sudo apt-get install -y shellcheck
- name: Run shellcheck
run: |
find . -name '*.sh' \( -path './z2k.sh' -o -path './z2k_cleanup.sh' -o -path './lib/*.sh' -o -path './files/*.sh' -o -path './tests/*.sh' \) \
| xargs shellcheck --severity=warning --exclude=SC1090,SC1091,SC3043,SC3040,SC2034,SC2148,SC2154
- name: Run shell unit tests
run: sh tests/run_all.sh
go-build:
name: Go Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "stable"
cache-dependency-path: |
mtproxy-client/go.sum
vps-relay/go.sum
- name: Go vet
working-directory: mtproxy-client
run: go vet ./...
- name: Go test
working-directory: mtproxy-client
run: go test ./...
- name: Cross-compile
working-directory: mtproxy-client
run: |
# All targets with arch-specific flags for max compatibility
# MIPS: softfloat (Keenetic MT7621, KN-3610 etc.)
# MIPS64: softfloat
# ARM: GOARM=5 (ARMv5, no VFP — max compat)
# All: CGO_ENABLED=0 (static), -ldflags="-s -w" (strip)
declare -A flags=(
["linux/arm64"]=""
["linux/arm"]="GOARM=5"
["linux/amd64"]=""
["linux/mips"]="GOMIPS=softfloat"
["linux/mipsle"]="GOMIPS=softfloat"
["linux/mips64le"]="GOMIPS64=softfloat"
["linux/ppc64"]=""
["linux/riscv64"]=""
["linux/386"]=""
)
for target in "${!flags[@]}"; do
GOOS="${target%%/*}"
GOARCH="${target##*/}"
EXTRA="${flags[$target]}"
echo "Building for ${GOOS}/${GOARCH} ${EXTRA}..."
env CGO_ENABLED=0 GOOS="$GOOS" GOARCH="$GOARCH" $EXTRA \
go build -ldflags="-s -w" -o /dev/null .
done
- name: Go vet (vps-relay)
working-directory: vps-relay
run: go vet ./...
- name: Go test (vps-relay)
working-directory: vps-relay
run: go test ./...
- name: Go build (vps-relay)
working-directory: vps-relay
run: go build ./...
lua-check:
name: Luacheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install luarocks and luacheck
run: |
sudo apt-get update
sudo apt-get install -y luarocks
sudo luarocks install luacheck
- name: Run luacheck
run: luacheck files/lua/*.lua --codes -q