ci(forgejo): add Actions for test, build, and releases
Some checks failed
CI / Test and build (push) Has been cancelled
Some checks failed
CI / Test and build (push) Has been cancelled
Host-mode workflows run Go inside golang:1.25-bookworm. CI covers push/PR; tagged v* builds multi-arch artifacts and publishes a Forgejo release.
This commit is contained in:
parent
ddbd19f153
commit
de5a66f5e8
2 changed files with 119 additions and 0 deletions
40
.forgejo/workflows/ci.yml
Normal file
40
.forgejo/workflows/ci.yml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# Host-mode runner: no local Go — use official golang image + docker.sock.
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: magpie-ci-${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test and build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: https://data.forgejo.org/actions/checkout@v4
|
||||
|
||||
- name: Go test and build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
case "$GITHUB_WORKSPACE" in
|
||||
/data/*) HOST_WORKSPACE="/opt/forgejo-runner/data${GITHUB_WORKSPACE#/data}" ;;
|
||||
*) HOST_WORKSPACE="$GITHUB_WORKSPACE" ;;
|
||||
esac
|
||||
test -f "$GITHUB_WORKSPACE/go.mod"
|
||||
docker run --rm --network host \
|
||||
--volume "$HOST_WORKSPACE:/src" \
|
||||
--workdir /src \
|
||||
-e CGO_ENABLED=0 \
|
||||
golang:1.25-bookworm \
|
||||
bash -lc '
|
||||
set -euo pipefail
|
||||
go version
|
||||
go test ./...
|
||||
make build
|
||||
ls -la dist/
|
||||
'
|
||||
Loading…
Add table
Add a link
Reference in a new issue