You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.7 KiB
91 lines
2.7 KiB
# This workflow will build a golang project for Gitea Actions |
|
# For more information see: https://docs.gitea.com/usage/actions/overview |
|
# |
|
# NOTE: All builds use CGO_ENABLED=0 since p8k library uses purego (not CGO) |
|
# The library dynamically loads libsecp256k1 at runtime via purego |
|
# |
|
# Release Process: |
|
# 1. Update the version in the pkg/version/version file (e.g. v1.2.3) |
|
# 2. Create and push a tag matching the version: |
|
# git tag v1.2.3 |
|
# git push origin v1.2.3 |
|
# 3. The workflow will automatically: |
|
# - Build binaries for Linux AMD64 |
|
# - Create a Gitea release with the binaries |
|
# - Generate checksums |
|
|
|
name: Go |
|
|
|
on: |
|
push: |
|
tags: |
|
- "v[0-9]+.[0-9]+.[0-9]+" |
|
|
|
jobs: |
|
build: |
|
runs-on: ubuntu-latest |
|
steps: |
|
- name: Checkout code |
|
uses: actions/checkout@v4 |
|
with: |
|
fetch-depth: 0 |
|
|
|
- name: Set up Go |
|
uses: actions/setup-go@v5 |
|
with: |
|
go-version: "1.25" |
|
|
|
- name: Build (Pure Go + purego) |
|
run: CGO_ENABLED=0 go build -v ./... |
|
|
|
- name: Test (Pure Go + purego) |
|
run: | |
|
# Copy the libsecp256k1.so to root directory so tests can find it |
|
cp pkg/crypto/p8k/libsecp256k1.so . |
|
CGO_ENABLED=0 go test -v $(go list ./... | xargs -n1 sh -c 'ls $0/*_test.go 1>/dev/null 2>&1 && echo $0' | grep .) |
|
|
|
release: |
|
needs: build |
|
runs-on: ubuntu-latest |
|
|
|
steps: |
|
- name: Checkout code |
|
uses: actions/checkout@v4 |
|
with: |
|
fetch-depth: 0 |
|
|
|
- name: Set up Go |
|
uses: actions/setup-go@v5 |
|
with: |
|
go-version: '1.25' |
|
|
|
- name: Build Release Binaries (Pure Go + purego) |
|
run: | |
|
# Extract version from tag (e.g., v1.2.3 -> 1.2.3) |
|
VERSION=${GITHUB_REF_NAME#v} |
|
echo "Building release binaries for version $VERSION (pure Go + purego)" |
|
|
|
# Create directory for binaries |
|
mkdir -p release-binaries |
|
|
|
# Copy the pre-compiled libsecp256k1.so for Linux AMD64 |
|
cp pkg/crypto/p8k/libsecp256k1.so release-binaries/libsecp256k1-linux-amd64.so |
|
|
|
# Build for Linux AMD64 (pure Go + purego dynamic loading) |
|
echo "Building Linux AMD64 (pure Go + purego dynamic loading)..." |
|
GOEXPERIMENT=greenteagc,jsonv2 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \ |
|
go build -ldflags "-s -w" -o release-binaries/orly-${VERSION}-linux-amd64 . |
|
|
|
# Create checksums |
|
cd release-binaries |
|
sha256sum * > SHA256SUMS.txt |
|
cd .. |
|
|
|
- name: Create Gitea Release |
|
uses: actions/upload-release-action@v1 |
|
with: |
|
repo_token: ${{ secrets.GITEA_TOKEN }} |
|
file: release-binaries/* |
|
tag: ${{ github.ref_name }} |
|
overwrite: true |
|
file_glob: true
|
|
|