Merge main into tinygo and fix conflicts
This commit is contained in:
27
.gitea/workflows/bearer.yml
Normal file
27
.gitea/workflows/bearer.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Bearer
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
scan:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Source
|
||||
uses: https://git.quad4.io/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- name: Run Bearer Security Scanner
|
||||
uses: https://git.quad4.io/actions/bearer-action@828eeb928ce2f4a7ca5ed57fb8b59508cb8c79bc # v2
|
||||
with:
|
||||
path: ./
|
||||
|
||||
105
.gitea/workflows/build.yml
Normal file
105
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,105 @@
|
||||
name: Go Build Multi-Platform
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main", "master" ]
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches: [ "main", "master" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
matrix:
|
||||
goos: [linux, windows, darwin, freebsd]
|
||||
goarch: [amd64, arm64, arm]
|
||||
include:
|
||||
- goos: js
|
||||
goarch: wasm
|
||||
exclude:
|
||||
- goos: darwin
|
||||
goarch: arm
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
build_complete: ${{ steps.build_step.outcome == 'success' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: https://git.quad4.io/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: https://git.quad4.io/actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
||||
with:
|
||||
go-version: '1.25'
|
||||
|
||||
- name: Setup Task
|
||||
uses: https://git.quad4.io/actions/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1
|
||||
with:
|
||||
version: '3.46.3'
|
||||
|
||||
- name: Build
|
||||
id: build_step
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
GOARM: ${{ matrix.goarch == 'arm' && '6' || '' }}
|
||||
CGO_ENABLED: '0'
|
||||
run: |
|
||||
output_name="reticulum-go-${GOOS}-${GOARCH}"
|
||||
if [ "$GOOS" = "js" ] && [ "$GOARCH" = "wasm" ]; then
|
||||
task build-wasm
|
||||
output_name+=".wasm"
|
||||
mv bin/reticulum-go.wasm "${output_name}"
|
||||
else
|
||||
task build
|
||||
if [ "$GOOS" = "windows" ]; then
|
||||
output_name+=".exe"
|
||||
fi
|
||||
mv bin/reticulum-go "${output_name}"
|
||||
fi
|
||||
echo "Built: ${output_name}"
|
||||
|
||||
- name: Calculate SHA256 Checksum
|
||||
run: |
|
||||
output_name="reticulum-go-${{ matrix.goos }}-${{ matrix.goarch }}"
|
||||
if [ "${{ matrix.goos }}" = "windows" ]; then
|
||||
output_name+=".exe"
|
||||
elif [ "${{ matrix.goos }}" = "js" ] && [ "${{ matrix.goarch }}" = "wasm" ]; then
|
||||
output_name+=".wasm"
|
||||
fi
|
||||
BINARY_PATH="${output_name}" task checksum
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: https://git.quad4.io/actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5 # v3.2.1
|
||||
with:
|
||||
name: reticulum-go-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
path: |
|
||||
reticulum-go-${{ matrix.goos }}-${{ matrix.goarch }}*
|
||||
|
||||
release:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Download All Build Artifacts
|
||||
uses: https://git.quad4.io/actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
|
||||
with:
|
||||
path: ./release-assets
|
||||
|
||||
- name: List downloaded files (for debugging)
|
||||
run: ls -R ./release-assets
|
||||
|
||||
- name: Create Gitea Release
|
||||
uses: https://git.quad4.io/actions/gitea-release-action@4875285c0950474efb7ca2df55233c51333eeb74
|
||||
with:
|
||||
files: ./release-assets/*/*
|
||||
105
.gitea/workflows/go-test.yml
Normal file
105
.gitea/workflows/go-test.yml
Normal file
@@ -0,0 +1,105 @@
|
||||
name: Go Test Multi-Platform
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
name: Test (${{ matrix.os }}, ${{ matrix.goarch }})
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# AMD64 testing on Linux
|
||||
- os: ubuntu-latest
|
||||
goarch: amd64
|
||||
# ARM64 testing on Linux
|
||||
- os: ubuntu-latest
|
||||
goarch: arm64
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Source
|
||||
uses: https://git.quad4.io/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Set up Go 1.25
|
||||
uses: https://git.quad4.io/actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
||||
with:
|
||||
go-version: '1.25'
|
||||
|
||||
- name: Setup Task
|
||||
uses: https://git.quad4.io/actions/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1
|
||||
with:
|
||||
version: '3.46.3'
|
||||
|
||||
- name: Cache Go modules
|
||||
uses: https://git.quad4.io/actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
key: ${{ runner.os }}-go-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-${{ matrix.goarch }}-
|
||||
|
||||
- name: Set up Node.js
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.goarch == 'amd64'
|
||||
uses: https://git.quad4.io/actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Run tests
|
||||
run: task test
|
||||
|
||||
- name: Run tests with race detector (Linux AMD64 only)
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.goarch == 'amd64'
|
||||
run: task test-race
|
||||
|
||||
- name: Run WebAssembly tests (Linux AMD64 only)
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.goarch == 'amd64'
|
||||
run: |
|
||||
chmod +x misc/wasm/go_js_wasm_exec
|
||||
task test-wasm
|
||||
|
||||
- name: Test build (ensure compilation works)
|
||||
run: |
|
||||
echo "Testing build for current platform (${{ matrix.os }}, ${{ matrix.goarch }})..."
|
||||
task build
|
||||
|
||||
- name: Test WebAssembly build (Linux AMD64 only)
|
||||
if: matrix.os == 'ubuntu-latest' && matrix.goarch == 'amd64'
|
||||
run: task build-wasm
|
||||
|
||||
- name: Test binary execution
|
||||
run: |
|
||||
echo "Testing binary execution on (${{ matrix.os }}, ${{ matrix.goarch }})..."
|
||||
timeout 5s ./bin/reticulum-go || echo "Binary started successfully (timeout expected)"
|
||||
|
||||
- name: Test cross-compilation (AMD64 runners only)
|
||||
if: matrix.goarch == 'amd64'
|
||||
run: |
|
||||
echo "Testing ARM64 cross-compilation from AMD64..."
|
||||
GOOS=linux GOARCH=arm64 task build
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: arm64
|
||||
|
||||
- name: Test ARMv6 cross-compilation (AMD64 runners only)
|
||||
if: matrix.goarch == 'amd64'
|
||||
run: |
|
||||
echo "Testing ARMv6 cross-compilation from AMD64..."
|
||||
GOOS=linux GOARCH=arm GOARM=6 task build
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: arm
|
||||
GOARM: 6
|
||||
27
.gitea/workflows/gosec.yml
Normal file
27
.gitea/workflows/gosec.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Run Gosec
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO111MODULE: on
|
||||
steps:
|
||||
- name: Checkout Source
|
||||
uses: https://git.quad4.io/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
- name: Run Gosec Security Scanner
|
||||
uses: https://git.quad4.io/actions/gosec@c073629009897d89e03229bc81232c7375892086
|
||||
with:
|
||||
args: ./...
|
||||
33
.gitea/workflows/revive.yml
Normal file
33
.gitea/workflows/revive.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
name: Go Revive Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main", "master" ]
|
||||
pull_request:
|
||||
branches: [ "main", "master" ]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: https://git.quad4.io/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: https://git.quad4.io/actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
|
||||
with:
|
||||
go-version: '1.25'
|
||||
|
||||
- name: Setup Task
|
||||
uses: https://git.quad4.io/actions/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1
|
||||
with:
|
||||
version: '3.46.3'
|
||||
|
||||
- name: Install revive
|
||||
run: go install github.com/mgechev/revive@latest
|
||||
|
||||
- name: Run lint
|
||||
run: task lint
|
||||
53
.gitea/workflows/sbom.yml
Normal file
53
.gitea/workflows/sbom.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
name: Generate SBOM
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
generate-sbom:
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://git.quad4.io/actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Go
|
||||
uses: https://git.quad4.io/actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5
|
||||
with:
|
||||
go-version: '1.25.5'
|
||||
|
||||
- name: Setup Task
|
||||
uses: https://git.quad4.io/actions/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1
|
||||
with:
|
||||
version: '3.46.3'
|
||||
|
||||
- name: Install dependencies
|
||||
run: task deps
|
||||
|
||||
- name: Install Trivy
|
||||
run: task trivy:install
|
||||
|
||||
- name: Generate SBOM
|
||||
run: task sbom
|
||||
|
||||
- name: Commit and Push Changes
|
||||
run: |
|
||||
git config --global user.name "Gitea Action"
|
||||
git config --global user.email "actions@noreply.quad4.io"
|
||||
git remote set-url origin https://${{ secrets.GITEA_TOKEN }}@git.quad4.io/${{ github.repository }}.git
|
||||
git fetch origin main || git fetch origin master
|
||||
git checkout main || git checkout master
|
||||
git add sbom/
|
||||
if ! git diff --quiet || ! git diff --staged --quiet; then
|
||||
git commit -m "Auto-update SBOM [skip ci]"
|
||||
git push origin main || git push origin master
|
||||
fi
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
86
.gitea/workflows/tinygo.yml
Normal file
86
.gitea/workflows/tinygo.yml
Normal file
@@ -0,0 +1,86 @@
|
||||
name: TinyGo Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "tinygo" ]
|
||||
pull_request:
|
||||
branches: [ "tinygo" ]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
tinygo-build-all:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: https://git.quad4.io/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: https://git.quad4.io/actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
|
||||
with:
|
||||
go-version: '1.24'
|
||||
|
||||
- name: Setup Task
|
||||
uses: https://git.quad4.io/actions/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1
|
||||
with:
|
||||
version: '3.46.3'
|
||||
|
||||
- name: Install TinyGo
|
||||
run: |
|
||||
wget https://github.com/tinygo-org/tinygo/releases/download/v0.37.0/tinygo_0.37.0_amd64.deb
|
||||
sudo dpkg -i tinygo_0.37.0_amd64.deb
|
||||
|
||||
- name: Build for all TinyGo targets
|
||||
id: build_step
|
||||
run: |
|
||||
task tinygo-build-all || true
|
||||
echo "Build process completed (some targets may have failed)"
|
||||
|
||||
- name: Collect build results
|
||||
run: |
|
||||
mkdir -p artifacts
|
||||
unsupported_file="artifacts/unsupported-microcontrollers.txt"
|
||||
echo "# Unsupported Microcontrollers" > "$unsupported_file"
|
||||
echo "# Generated: $(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> "$unsupported_file"
|
||||
echo "" >> "$unsupported_file"
|
||||
|
||||
failed_count=0
|
||||
for log_file in bin/build-*.log; do
|
||||
if [ -f "$log_file" ]; then
|
||||
target=$(basename "$log_file" | sed 's/build-\(.*\)\.log/\1/')
|
||||
binary_file="bin/reticulum-go-${target}"
|
||||
|
||||
if [ ! -f "$binary_file" ] || grep -qi "error\|Error\|ERROR\|failed\|Failed\|FAILED" "$log_file"; then
|
||||
failed_count=$((failed_count + 1))
|
||||
echo "## $target" >> "$unsupported_file"
|
||||
echo "" >> "$unsupported_file"
|
||||
|
||||
if grep -qi "program too large\|overflowed\|too big\|LLVM ERROR\|Error while" "$log_file"; then
|
||||
grep -i "program too large\|overflowed\|too big\|LLVM ERROR\|Error while" "$log_file" | head -5 >> "$unsupported_file"
|
||||
else
|
||||
tail -15 "$log_file" >> "$unsupported_file"
|
||||
fi
|
||||
|
||||
echo "" >> "$unsupported_file"
|
||||
echo "\`\`\`" >> "$unsupported_file"
|
||||
tail -30 "$log_file" >> "$unsupported_file"
|
||||
echo "\`\`\`" >> "$unsupported_file"
|
||||
echo "" >> "$unsupported_file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Total failed builds: $failed_count" >> "$unsupported_file"
|
||||
echo "Generated unsupported-microcontrollers.txt with $failed_count failed targets"
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: https://git.quad4.io/actions/upload-artifact@ff15f0306b3f739f7b6fd43fb5d26cd321bd4de5
|
||||
with:
|
||||
name: tinygo-builds
|
||||
path: |
|
||||
bin/reticulum-go-*
|
||||
artifacts/unsupported-microcontrollers.txt
|
||||
if-no-files-found: warn
|
||||
Reference in New Issue
Block a user