Init commit
Some checks failed
CI/CD Pipeline / Build Docker Image (push) Has been cancelled
CI/CD Pipeline / Test (push) Has been cancelled
CI/CD Pipeline / Build (arm64, windows, linkbeam-windows-arm64.exe) (push) Has been cancelled
CI/CD Pipeline / Build (386, linux, linkbeam-linux-386) (push) Has been cancelled
CI/CD Pipeline / Lint (push) Has been cancelled
CI/CD Pipeline / Build (amd64, linux, linkbeam-linux-amd64) (push) Has been cancelled
CI/CD Pipeline / Build (arm, 7, linux, linkbeam-linux-armv7) (push) Has been cancelled
CI/CD Pipeline / Build (386, windows, linkbeam-windows-386.exe) (push) Has been cancelled
CI/CD Pipeline / Build (amd64, windows, linkbeam-windows-amd64.exe) (push) Has been cancelled
CI/CD Pipeline / Build (arm64, darwin, linkbeam-darwin-arm64) (push) Has been cancelled
CI/CD Pipeline / Build (arm64, linux, linkbeam-linux-arm64) (push) Has been cancelled
CI/CD Pipeline / Build (amd64, darwin, linkbeam-darwin-amd64) (push) Has been cancelled
CI/CD Pipeline / Create Release (push) Has been cancelled

This commit is contained in:
2025-10-12 21:56:53 +04:00
commit 20f949c250
42 changed files with 4478 additions and 0 deletions

218
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,218 @@
name: CI/CD Pipeline
on:
push:
branches:
- main
- develop
tags:
- 'v*'
pull_request:
branches:
- main
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=5m
- name: Run go fmt check
run: |
if [ -n "$(gofmt -l .)" ]; then
echo "Code is not formatted. Run 'go fmt ./...'"
gofmt -l .
exit 1
fi
- name: Run go vet
run: go vet ./...
test:
name: Test
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Run tests
run: go test -v -race -coverprofile=coverage.out ./...
- name: Generate coverage report
run: go tool cover -html=coverage.out -o coverage.html
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
coverage.out
coverage.html
build:
name: Build
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
include:
# Linux builds
- goos: linux
goarch: amd64
output: linkbeam-linux-amd64
- goos: linux
goarch: 386
output: linkbeam-linux-386
- goos: linux
goarch: arm64
output: linkbeam-linux-arm64
- goos: linux
goarch: arm
goarm: 7
output: linkbeam-linux-armv7
# Windows builds
- goos: windows
goarch: amd64
output: linkbeam-windows-amd64.exe
- goos: windows
goarch: 386
output: linkbeam-windows-386.exe
- goos: windows
goarch: arm64
output: linkbeam-windows-arm64.exe
# macOS builds
- goos: darwin
goarch: amd64
output: linkbeam-darwin-amd64
- goos: darwin
goarch: arm64
output: linkbeam-darwin-arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
run: |
go build -o dist/${{ matrix.output }} \
-ldflags="-s -w -X main.Version=${{ github.ref_name }} -X main.Commit=${{ github.sha }}" \
./cmd/linkbeam
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.output }}
path: dist/${{ matrix.output }}
docker:
name: Build Docker Image
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
gitea.example.com/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Save Docker image
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: |
docker save -o linkbeam-docker-image.tar ${{ steps.meta.outputs.tags }}
- name: Upload Docker image artifact
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: docker-image
path: linkbeam-docker-image.tar
release:
name: Create Release
runs-on: ubuntu-latest
needs: [build, docker]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release-artifacts
- name: Create checksums
run: |
cd release-artifacts
find . -type f -name "linkbeam-*" -exec sha256sum {} \; > checksums.txt
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
- name: Upload release assets
uses: softprops/action-gh-release@v1
with:
files: |
release-artifacts/**/*
release-artifacts/checksums.txt

View File

@@ -0,0 +1,61 @@
name: Docker Publish
on:
push:
tags:
- 'v*'
workflow_dispatch:
env:
REGISTRY: gitea.example.com
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max
build-args: |
VERSION=${{ github.ref_name }}
COMMIT=${{ github.sha }}

View File

@@ -0,0 +1,135 @@
name: Release
on:
push:
tags:
- 'v*.*.*'
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
body: |
## What's Changed
See [CHANGELOG.md](./CHANGELOG.md) for details.
## Installation
Download the appropriate binary for your platform below.
### Docker
```bash
docker pull gitea.example.com/${{ github.repository }}:${{ github.ref_name }}
```
### Verification
Verify your download with the provided SHA256 checksums.
draft: false
prerelease: false
build-and-upload:
name: Build and Upload Assets
needs: create-release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: 386
- goos: linux
goarch: arm64
- goos: linux
goarch: arm
goarm: 7
- goos: windows
goarch: amd64
- goos: windows
goarch: 386
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
run: |
BINARY_NAME="linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}"
if [ "${{ matrix.goarm }}" != "" ]; then
BINARY_NAME="${BINARY_NAME}v${{ matrix.goarm }}"
fi
if [ "${{ matrix.goos }}" = "windows" ]; then
BINARY_NAME="${BINARY_NAME}.exe"
fi
go build -o "${BINARY_NAME}" \
-ldflags="-s -w -X main.Version=${{ github.ref_name }} -X main.Commit=${{ github.sha }}" \
./cmd/linkbeam
# Create tarball (except for Windows)
if [ "${{ matrix.goos }}" != "windows" ]; then
tar -czf "${BINARY_NAME}.tar.gz" "${BINARY_NAME}"
sha256sum "${BINARY_NAME}.tar.gz" > "${BINARY_NAME}.tar.gz.sha256"
rm "${BINARY_NAME}"
else
zip "${BINARY_NAME}.zip" "${BINARY_NAME}"
sha256sum "${BINARY_NAME}.zip" > "${BINARY_NAME}.zip.sha256"
rm "${BINARY_NAME}"
fi
- name: Upload Release Asset (tar.gz)
if: matrix.goos != 'windows'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}.tar.gz
asset_name: linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset (zip)
if: matrix.goos == 'windows'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}.exe.zip
asset_name: linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}.zip
asset_content_type: application/zip
- name: Upload Checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}${{ matrix.goos == 'windows' && '.exe.zip.sha256' || '.tar.gz.sha256' }}
asset_name: linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}${{ matrix.goos == 'windows' && '.zip.sha256' || '.tar.gz.sha256' }}
asset_content_type: text/plain