GitHub torrentclaw org is shadow-banned; CI is hosted at git.torrentclaw.com now. Move workflows into the runner's natively-watched .forgejo/workflows/ tree and adapt steps to run in the available 'docker'-labeled Forgejo runner without GitHub-only tooling (gh CLI, third-party marketplace actions). - Use container: image to ship the toolchain (no actions/setup-* needed). - Drop GitHub-only marketplace actions in favour of upstream installers invoked over curl/apt. - Where a workflow created a GitHub Release (release.yml), substitute the step with a curl call against the Forgejo Releases API (POST /repos/<owner>/<repo>/releases).
71 lines
1.8 KiB
YAML
71 lines
1.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: docker
|
|
container:
|
|
image: docker.io/library/golang:1.24
|
|
strategy:
|
|
matrix:
|
|
go-version: ["1.22", "1.23", "1.24"]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Pin Go version (matrix override)
|
|
if: matrix.go-version != '1.24'
|
|
run: |
|
|
curl -sSL "https://go.dev/dl/go${{ matrix.go-version }}.linux-amd64.tar.gz" \
|
|
| tar -C /usr/local --strip-components=1 -xz
|
|
go version
|
|
|
|
- name: Run tests
|
|
run: go test -v -race -count=1 ./...
|
|
|
|
- name: Run tests with coverage
|
|
if: matrix.go-version == '1.24'
|
|
run: |
|
|
go test -race -coverprofile=coverage.out -covermode=atomic ./...
|
|
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
|
|
echo "Total coverage: ${COVERAGE}%"
|
|
apt-get update && apt-get install -y --no-install-recommends bc
|
|
if [ "$(echo "$COVERAGE < 90" | bc)" -eq 1 ]; then
|
|
echo "::error::Coverage ${COVERAGE}% is below 90% threshold"
|
|
exit 1
|
|
fi
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: docker
|
|
container:
|
|
image: docker.io/library/golang:1.24
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install golangci-lint
|
|
run: |
|
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
|
|
| sh -s -- -b /usr/local/bin latest
|
|
|
|
- name: Run golangci-lint
|
|
run: golangci-lint run ./...
|
|
|
|
vet:
|
|
name: Vet
|
|
runs-on: docker
|
|
container:
|
|
image: docker.io/library/golang:1.24
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Run go vet
|
|
run: go vet ./...
|