ci: port workflows from .github/ to .forgejo/ (Forgejo Actions)
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).
This commit is contained in:
parent
f6f24c2c3f
commit
8764a98156
1 changed files with 21 additions and 27 deletions
|
|
@ -12,17 +12,21 @@ permissions:
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
name: Test
|
name: Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/library/golang:1.24
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: ["1.22", "1.23", "1.24"]
|
go-version: ["1.22", "1.23", "1.24"]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Pin Go version (matrix override)
|
||||||
uses: actions/setup-go@v5
|
if: matrix.go-version != '1.24'
|
||||||
with:
|
run: |
|
||||||
go-version: ${{ matrix.go-version }}
|
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
|
- name: Run tests
|
||||||
run: go test -v -race -count=1 ./...
|
run: go test -v -race -count=1 ./...
|
||||||
|
|
@ -33,45 +37,35 @@ jobs:
|
||||||
go test -race -coverprofile=coverage.out -covermode=atomic ./...
|
go test -race -coverprofile=coverage.out -covermode=atomic ./...
|
||||||
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
|
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}' | sed 's/%//')
|
||||||
echo "Total coverage: ${COVERAGE}%"
|
echo "Total coverage: ${COVERAGE}%"
|
||||||
|
apt-get update && apt-get install -y --no-install-recommends bc
|
||||||
if [ "$(echo "$COVERAGE < 90" | bc)" -eq 1 ]; then
|
if [ "$(echo "$COVERAGE < 90" | bc)" -eq 1 ]; then
|
||||||
echo "::error::Coverage ${COVERAGE}% is below 90% threshold"
|
echo "::error::Coverage ${COVERAGE}% is below 90% threshold"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload coverage
|
|
||||||
if: matrix.go-version == '1.24'
|
|
||||||
uses: codecov/codecov-action@v4
|
|
||||||
with:
|
|
||||||
files: coverage.out
|
|
||||||
env:
|
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
name: Lint
|
name: Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/library/golang:1.24
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Install golangci-lint
|
||||||
uses: actions/setup-go@v5
|
run: |
|
||||||
with:
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
|
||||||
go-version: "1.24"
|
| sh -s -- -b /usr/local/bin latest
|
||||||
|
|
||||||
- name: Run golangci-lint
|
- name: Run golangci-lint
|
||||||
uses: golangci/golangci-lint-action@v6
|
run: golangci-lint run ./...
|
||||||
with:
|
|
||||||
version: latest
|
|
||||||
|
|
||||||
vet:
|
vet:
|
||||||
name: Vet
|
name: Vet
|
||||||
runs-on: ubuntu-latest
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: docker.io/library/golang:1.24
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Go
|
|
||||||
uses: actions/setup-go@v5
|
|
||||||
with:
|
|
||||||
go-version: "1.24"
|
|
||||||
|
|
||||||
- name: Run go vet
|
- name: Run go vet
|
||||||
run: go vet ./...
|
run: go vet ./...
|
||||||
Loading…
Add table
Add a link
Reference in a new issue