feat: add initial implementation of Go utilities and CI workflows

This commit is contained in:
2025-06-18 16:46:01 -04:00
commit c588ade142
12 changed files with 475 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
on:
push:
tags:
- "v*"
name: 🚀 Publish Release Package
jobs:
publish:
env:
NODE_TLS_REJECT_UNAUTHORIZED: 0
runs-on: ubuntu-latest
steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates
run: |
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates
- name: 📥 Checkout code
uses: actions/checkout@v2
- name: Install gopack
run: |
curl -L https://github.com/cloudsmith-io/gopack/releases/download/v0.6.0/gopack_0.6.0_linux_amd64.tar.gz -o /tmp/gopack.tar.gz
tar -xzf /tmp/gopack.tar.gz -C /tmp
mv /tmp/gopack /usr/local/bin/gopack
- name: 📦 Build Go Package
run: |
gopack ${{ github.ref_name }} .
- name: 📦 Publish Build Artifacts
uses: christopherhx/gitea-upload-artifact@v4
with:
name: ${{ github.ref_name }}
path: ${{ github.ref_name }}.zip
retention-days: 1
- name: ☁️ Upload release package
run: |
curl --user ${{ secrets.PACKAGE_PUBLISH_USER }}:${{ secrets.PACKAGE_PUBLISH_TOKEN }} \
--upload-file ${{ github.ref_name }}.zip \
${{ gitea.server_url }}/api/packages/packages/go/upload
if [ $? -ne 0 ]; then
echo "Error uploading release package"
exit 1
fi
echo "Upload successful"

View File

@@ -0,0 +1,77 @@
on:
workflow_dispatch: {}
push:
branches:
- "*"
name: 🧪 ✨ Tests Workflow
env:
GO_VERSION: '1.24.3'
jobs:
lint-go:
name: 🔍 🐹 Go Lint
runs-on: ubuntu-latest
steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates
run: |
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates
- name: ⚙️ 🐹 Set up Go Environment
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: 📖 🔍 Checkout Repository Code
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: 📦 📥 Install Dependencies
run: |
go mod download
- name: ✅ 🔍 Run Go Lint
uses: golangci/golangci-lint-action@v8.0.0
test-go:
name: 🔍 🐹 Go Tests
runs-on: ubuntu-latest
steps:
- name: 🛡️ 🔒 Add Siteworx CA Certificates
run: |
curl -Ls https://siteworxpro.com/hosted/Siteworx+Root+CA.pem -o /usr/local/share/ca-certificates/sw.crt
update-ca-certificates
- name: ⚙️ 🐹 Set up Go Environment
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: 📖 🔍 Checkout Repository Code
uses: actions/checkout@v2
with:
fetch-depth: 1
- name: 📦 📥 Install Dependencies
run: |
go mod download
- name: ✅ 🔍 Run Go Tests
run: |
go test -v ./... -coverprofile=coverage.out
- name: 📊 📈 Upload Coverage Report
env:
NODE_TLS_REJECT_UNAUTHORIZED: 0
uses: christopherhx/gitea-upload-artifact@v4
with:
name: coverage-report
path: coverage.out
retention-days: 7