mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
@@ -0,0 +1,97 @@
|
||||
name: Bump version
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
env:
|
||||
NODE_VERSION: 20
|
||||
PNPM_VERSION: 10
|
||||
jobs:
|
||||
changes:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
minor: ${{ steps.check-milestone.outputs.minor }}
|
||||
non-docs: ${{ steps.filter.outputs.non-docs }}
|
||||
packages: ${{ steps.filter.outputs.packages }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
non-docs:
|
||||
- '!docs/**'
|
||||
- '!README.md'
|
||||
packages:
|
||||
- 'packages/**'
|
||||
- 'cli/**'
|
||||
- 'web/**'
|
||||
- 'pnpm-lock.yaml'
|
||||
# Check if any milestone has all issues closed
|
||||
- name: Check milestone completion
|
||||
id: check-milestone
|
||||
run: |
|
||||
# Get all open milestones and check if any have all issues closed
|
||||
MILESTONES=$(gh api repos/${{ github.repository }}/milestones --jq '.[] | select(.state == "open") | {title, open_issues}')
|
||||
|
||||
# Check if any milestone has 0 open issues
|
||||
MINOR_BUMP=false
|
||||
while IFS= read -r milestone; do
|
||||
if [ -n "$milestone" ]; then
|
||||
OPEN_ISSUES=$(echo "$milestone" | jq -r '.open_issues')
|
||||
TITLE=$(echo "$milestone" | jq -r '.title')
|
||||
if [ "$OPEN_ISSUES" = "0" ]; then
|
||||
echo "Milestone '$TITLE' is complete (0 open issues). Minor bump required."
|
||||
MINOR_BUMP=true
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done <<< "$(echo "$MILESTONES" | jq -c '.')"
|
||||
|
||||
echo "minor=$MINOR_BUMP" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_PAT_TOKEN }} # Handle Go/Binary versioning with commitizen
|
||||
|
||||
version-go:
|
||||
needs: changes
|
||||
if: "!startsWith(github.event.head_commit.message, 'bump:') && !startsWith(github.event.head_commit.message, 'hotfix:') && !startsWith(github.event.head_commit.message, 'Version Packages') && needs.changes.outputs.non-docs == 'true'"
|
||||
runs-on: ubuntu-latest
|
||||
name: "Bump Go binary version and create changelog"
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ssh-key: "${{ secrets.COMMIT_KEY }}"
|
||||
- name: Determine increment type
|
||||
id: increment
|
||||
run: |
|
||||
# Use the version-bump.sh script to determine increment type
|
||||
INCREMENT_TYPE=$(./scripts/version-bump.sh increment-type true ${{ github.repository }})
|
||||
echo "type=$INCREMENT_TYPE" >> $GITHUB_OUTPUT
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
|
||||
- name: Create bump and changelog
|
||||
uses: commitizen-tools/commitizen-action@master
|
||||
with:
|
||||
push: false
|
||||
increment: ${{ steps.increment.outputs.type }}
|
||||
- name: Push using ssh
|
||||
run: |
|
||||
git push origin master --tags
|
||||
|
||||
close-milestone:
|
||||
needs: [changes, version-go]
|
||||
if: "needs.changes.outputs.minor == 'true'"
|
||||
runs-on: ubuntu-latest
|
||||
name: "Close completed milestone"
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v4
|
||||
- name: Close completed milestone
|
||||
run: |
|
||||
./scripts/version-bump.sh close-milestone ${{ github.repository }}
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
|
||||
@@ -0,0 +1,129 @@
|
||||
name: CD
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
bump:
|
||||
required: false
|
||||
type: string
|
||||
release:
|
||||
required: false
|
||||
type: string
|
||||
publish:
|
||||
required: false
|
||||
type: string
|
||||
deploy:
|
||||
required: false
|
||||
type: string
|
||||
continue-on-error:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
devbox-version:
|
||||
required: false
|
||||
default: 0.16.0
|
||||
type: string
|
||||
enable-cache:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
fetch-depth:
|
||||
required: false
|
||||
default: 0
|
||||
type: number
|
||||
persist-credentials:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
runs-on:
|
||||
required: false
|
||||
default: ubuntu-latest
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
bump:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
environment: staging - cd
|
||||
if: ${{ inputs.test != '' }}
|
||||
name: Bump
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: ${{ inputs.persist-credentials }}
|
||||
fetch-depth: ${{ inputs.fetch-depth }}
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: ${{ inputs.enable-cache }}
|
||||
devbox-version: ${{ inputs.devbox-version }}
|
||||
- name: "Bump ${{ inputs.bump }}"
|
||||
run: devbox run bump:${{ inputs.bump }}
|
||||
if: ${{ inputs.bump != '' }}
|
||||
continue-on-error: ${{ inputs.continue-on-error }}
|
||||
|
||||
release:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
environment: staging - cd
|
||||
if: ${{ inputs.release != '' }}
|
||||
name: Release
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: ${{ inputs.persist-credentials }}
|
||||
fetch-depth: ${{ inputs.fetch-depth }}
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: ${{ inputs.enable-cache }}
|
||||
devbox-version: ${{ inputs.devbox-version }}
|
||||
- name: "Release ${{ inputs.release }}"
|
||||
run: devbox run release:${{ inputs.release }}
|
||||
if: ${{ inputs.release != '' }}
|
||||
continue-on-error: ${{ inputs.continue-on-error }}
|
||||
|
||||
publish:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
environment: staging - publish
|
||||
if: ${{ inputs.publish != '' }}
|
||||
name: Publish
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: ${{ inputs.persist-credentials }}
|
||||
fetch-depth: ${{ inputs.fetch-depth }}
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: ${{ inputs.enable-cache }}
|
||||
devbox-version: ${{ inputs.devbox-version }}
|
||||
- name: "Install ${{ inputs.install }}"
|
||||
run: devbox run install:${{ inputs.install }}
|
||||
- name: "Publish ${{ inputs.publish }}"
|
||||
run: devbox run publish:${{ inputs.publish }}
|
||||
if: ${{ inputs.publish != '' }}
|
||||
continue-on-error: ${{ inputs.continue-on-error }}
|
||||
|
||||
deploy:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
environment: staging - deploy
|
||||
if: ${{ inputs.deploy != '' }}
|
||||
name: Deploy
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: ${{ inputs.persist-credentials }}
|
||||
fetch-depth: ${{ inputs.fetch-depth }}
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: ${{ inputs.enable-cache }}
|
||||
devbox-version: ${{ inputs.devbox-version }}
|
||||
- name: "Install ${{ inputs.install }}"
|
||||
run: devbox run install:${{ inputs.install }}
|
||||
- name: "Deploy ${{ inputs.deploy }}"
|
||||
run: devbox run deploy:${{ inputs.deploy }}
|
||||
if: ${{ inputs.deploy != '' }}
|
||||
continue-on-error: ${{ inputs.continue-on-error }}
|
||||
@@ -0,0 +1,136 @@
|
||||
|
||||
name: Changes
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
modules:
|
||||
description: "JSON array of changed modules"
|
||||
value: ${{ jobs.detect.outputs.modules }}
|
||||
core:
|
||||
description: "True if core files changed"
|
||||
value: ${{ jobs.detect.outputs.core }}
|
||||
app:
|
||||
description: "True if app files changed"
|
||||
value: ${{ jobs.detect.outputs.app }}
|
||||
crypto:
|
||||
description: "True if crypto files changed"
|
||||
value: ${{ jobs.detect.outputs.crypto }}
|
||||
hway:
|
||||
description: "True if highway files changed"
|
||||
value: ${{ jobs.detect.outputs.hway }}
|
||||
client:
|
||||
description: "True if client files changed"
|
||||
value: ${{ jobs.detect.outputs.client }}
|
||||
packages-changes:
|
||||
description: "True if JS packages changed"
|
||||
value: ${{ jobs.detect.outputs.packages-changes }}
|
||||
web-changes:
|
||||
description: "True if web app files changed"
|
||||
value: ${{ jobs.detect.outputs.web-changes }}
|
||||
go-changes:
|
||||
description: "True if Go files changed"
|
||||
value: ${{ jobs.detect.outputs.go-changes }}
|
||||
wasm-changes:
|
||||
description: "True if WASM files changed"
|
||||
value: ${{ jobs.detect.outputs.wasm-changes }}
|
||||
docker-changes:
|
||||
description: "True if Docker files changed"
|
||||
value: ${{ jobs.detect.outputs.docker-changes }}
|
||||
|
||||
jobs:
|
||||
detect:
|
||||
name: Find Changes
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
modules: ${{ steps.set-modules.outputs.modules }}
|
||||
core: ${{ steps.filter.outputs.core }}
|
||||
app: ${{ steps.filter.outputs.app }}
|
||||
crypto: ${{ steps.filter.outputs.crypto }}
|
||||
hway: ${{ steps.filter.outputs.hway }}
|
||||
client: ${{ steps.filter.outputs.client }}
|
||||
packages-changes: ${{ steps.filter.outputs.packages-changes == 'true' }}
|
||||
web-changes: ${{ steps.filter.outputs.web-changes == 'true' }}
|
||||
go-changes: ${{ steps.filter.outputs.go-changes == 'true' }}
|
||||
wasm-changes: ${{ steps.filter.outputs.wasm-changes == 'true' }}
|
||||
docker-changes: ${{ steps.filter.outputs.docker-changes == 'true' }}
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
- name: Detect changed files
|
||||
uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
dex:
|
||||
- 'x/dex/**'
|
||||
- 'proto/sonr/dex/**'
|
||||
did:
|
||||
- 'x/did/**'
|
||||
- 'proto/sonr/did/**'
|
||||
dwn:
|
||||
- 'x/dwn/**'
|
||||
- 'proto/sonr/dwn/**'
|
||||
svc:
|
||||
- 'x/svc/**'
|
||||
- 'proto/sonr/svc/**'
|
||||
hway:
|
||||
- 'cmd/hway/**'
|
||||
- 'internal/bridge/**'
|
||||
- 'internal/**'
|
||||
crypto:
|
||||
- 'crypto/**'
|
||||
client:
|
||||
- 'client/**'
|
||||
- 'client/go.mod'
|
||||
- 'client/go.sum'
|
||||
core:
|
||||
- 'app/**'
|
||||
- 'cmd/**'
|
||||
- 'go.mod'
|
||||
- 'go.sum'
|
||||
packages-changes:
|
||||
- 'packages/**'
|
||||
- 'pnpm-lock.yaml'
|
||||
- 'package.json'
|
||||
- 'tsconfig.json'
|
||||
web-changes:
|
||||
- 'web/**'
|
||||
- 'pnpm-lock.yaml'
|
||||
- 'package.json'
|
||||
go-changes:
|
||||
- 'app/**'
|
||||
- 'x/**'
|
||||
- 'cmd/**'
|
||||
- 'client/**'
|
||||
- 'go.mod'
|
||||
- 'go.sum'
|
||||
wasm-changes:
|
||||
- 'cmd/vault/**'
|
||||
- 'x/dwn/client/wasm/main.go'
|
||||
- 'x/dwn/Makefile'
|
||||
docker-changes:
|
||||
- 'Dockerfile'
|
||||
list-files: json
|
||||
- name: Set module outputs
|
||||
id: set-modules
|
||||
run: |
|
||||
modules=()
|
||||
if [[ "${{ steps.filter.outputs.dex }}" == "true" ]]; then
|
||||
modules+=("dex")
|
||||
fi
|
||||
if [[ "${{ steps.filter.outputs.did }}" == "true" ]]; then
|
||||
modules+=("did")
|
||||
fi
|
||||
if [[ "${{ steps.filter.outputs.dwn }}" == "true" ]]; then
|
||||
modules+=("dwn")
|
||||
fi
|
||||
if [[ "${{ steps.filter.outputs.svc }}" == "true" ]]; then
|
||||
modules+=("svc")
|
||||
fi
|
||||
|
||||
if [[ ${#modules[@]} -eq 0 ]]; then
|
||||
echo "modules=[]" >> $GITHUB_OUTPUT
|
||||
else
|
||||
printf -v joined '"%s",' "${modules[@]}"
|
||||
echo "modules=[${joined%,}]" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
@@ -0,0 +1,101 @@
|
||||
name: CI
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
build:
|
||||
required: false
|
||||
type: string
|
||||
snapshot:
|
||||
required: false
|
||||
type: string
|
||||
test:
|
||||
required: false
|
||||
type: string
|
||||
continue-on-error:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
devbox-version:
|
||||
required: false
|
||||
default: 0.16.0
|
||||
type: string
|
||||
enable-cache:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
fetch-depth:
|
||||
required: false
|
||||
default: 0
|
||||
type: number
|
||||
persist-credentials:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
runs-on:
|
||||
required: false
|
||||
default: ubuntu-latest
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
environment: staging - ci
|
||||
if: ${{ inputs.test != '' }}
|
||||
name: Test
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: ${{ inputs.persist-credentials }}
|
||||
fetch-depth: ${{ inputs.fetch-depth }}
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: ${{ inputs.enable-cache }}
|
||||
devbox-version: ${{ inputs.devbox-version }}
|
||||
- name: "Test ${{ inputs.test }}"
|
||||
run: devbox run test:${{ inputs.test }}
|
||||
if: ${{ inputs.test != '' }}
|
||||
continue-on-error: ${{ inputs.continue-on-error }}
|
||||
|
||||
build:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
environment: staging - ci
|
||||
if: ${{ inputs.build != '' }}
|
||||
name: Build
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: ${{ inputs.persist-credentials }}
|
||||
fetch-depth: ${{ inputs.fetch-depth }}
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: ${{ inputs.enable-cache }}
|
||||
devbox-version: ${{ inputs.devbox-version }}
|
||||
- name: "Build ${{ inputs.build }}"
|
||||
run: devbox run build:${{ inputs.build }}
|
||||
if: ${{ inputs.build != '' }}
|
||||
continue-on-error: ${{ inputs.continue-on-error }}
|
||||
|
||||
snapshot:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
environment: staging - ci
|
||||
if: ${{ inputs.snapshot != '' }}
|
||||
name: Deploy
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: ${{ inputs.persist-credentials }}
|
||||
fetch-depth: ${{ inputs.fetch-depth }}
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: ${{ inputs.enable-cache }}
|
||||
devbox-version: ${{ inputs.devbox-version }}
|
||||
- name: "Snapshot ${{ inputs.snapshot }}"
|
||||
run: devbox run snapshot:${{ inputs.snapshot }}
|
||||
if: ${{ inputs.snapshot != '' }}
|
||||
continue-on-error: ${{ inputs.continue-on-error }}
|
||||
@@ -0,0 +1,137 @@
|
||||
name: Devbox Run
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
install:
|
||||
required: true
|
||||
default: go
|
||||
type: string
|
||||
build:
|
||||
required: false
|
||||
type: string
|
||||
deploy:
|
||||
required: false
|
||||
type: string
|
||||
publish:
|
||||
required: false
|
||||
type: string
|
||||
test:
|
||||
required: false
|
||||
type: string
|
||||
continue-on-error:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
devbox-version:
|
||||
required: false
|
||||
default: 0.16.0
|
||||
type: string
|
||||
enable-cache:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
fetch-depth:
|
||||
required: false
|
||||
default: 0
|
||||
type: number
|
||||
persist-credentials:
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
runs-on:
|
||||
required: false
|
||||
default: ubuntu-latest
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
environment: staging - test
|
||||
if: ${{ inputs.test != '' }}
|
||||
name: Test
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: ${{ inputs.persist-credentials }}
|
||||
fetch-depth: ${{ inputs.fetch-depth }}
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: ${{ inputs.enable-cache }}
|
||||
devbox-version: ${{ inputs.devbox-version }}
|
||||
- name: "Install ${{ inputs.install }}"
|
||||
run: devbox run install:${{ inputs.install }}
|
||||
- name: "Test ${{ inputs.test }}"
|
||||
run: devbox run test:${{ inputs.test }}
|
||||
if: ${{ inputs.test != '' }}
|
||||
continue-on-error: ${{ inputs.continue-on-error }}
|
||||
|
||||
build:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
environment: staging - build
|
||||
if: ${{ inputs.build != '' }}
|
||||
name: Build
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: ${{ inputs.persist-credentials }}
|
||||
fetch-depth: ${{ inputs.fetch-depth }}
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: ${{ inputs.enable-cache }}
|
||||
devbox-version: ${{ inputs.devbox-version }}
|
||||
- name: "Install ${{ inputs.install }}"
|
||||
run: devbox run install:${{ inputs.install }}
|
||||
- name: "Build ${{ inputs.build }}"
|
||||
run: devbox run build:${{ inputs.build }}
|
||||
if: ${{ inputs.build != '' }}
|
||||
continue-on-error: ${{ inputs.continue-on-error }}
|
||||
|
||||
publish:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
environment: staging - publish
|
||||
if: ${{ inputs.publish != '' }}
|
||||
name: Publish
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: ${{ inputs.persist-credentials }}
|
||||
fetch-depth: ${{ inputs.fetch-depth }}
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: ${{ inputs.enable-cache }}
|
||||
devbox-version: ${{ inputs.devbox-version }}
|
||||
- name: "Install ${{ inputs.install }}"
|
||||
run: devbox run install:${{ inputs.install }}
|
||||
- name: "Publish ${{ inputs.publish }}"
|
||||
run: devbox run publish:${{ inputs.publish }}
|
||||
if: ${{ inputs.publish != '' }}
|
||||
continue-on-error: ${{ inputs.continue-on-error }}
|
||||
|
||||
deploy:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
environment: staging - deploy
|
||||
if: ${{ inputs.deploy != '' }}
|
||||
name: Deploy
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: ${{ inputs.persist-credentials }}
|
||||
fetch-depth: ${{ inputs.fetch-depth }}
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.13.0
|
||||
with:
|
||||
enable-cache: ${{ inputs.enable-cache }}
|
||||
devbox-version: ${{ inputs.devbox-version }}
|
||||
- name: "Install ${{ inputs.install }}"
|
||||
run: devbox run install:${{ inputs.install }}
|
||||
- name: "Deploy ${{ inputs.deploy }}"
|
||||
run: devbox run deploy:${{ inputs.deploy }}
|
||||
if: ${{ inputs.deploy != '' }}
|
||||
continue-on-error: ${{ inputs.continue-on-error }}
|
||||
@@ -0,0 +1,99 @@
|
||||
name: CI
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [master]
|
||||
workflow_dispatch:
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
env:
|
||||
GO_VERSION: 1.24.4
|
||||
NODE_VERSION: 20
|
||||
PNPM_VERSION: 10
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
packages: write
|
||||
jobs:
|
||||
detect-changes:
|
||||
name: Analyze
|
||||
uses: ./.github/workflows/changes.yml
|
||||
|
||||
client:
|
||||
name: Client
|
||||
needs: detect-changes
|
||||
if: ${{ needs.detect-changes.outputs.client == 'true' }}
|
||||
uses: ./.github/workflows/devbox.yml
|
||||
with:
|
||||
install: go
|
||||
test: client
|
||||
build: client
|
||||
|
||||
core:
|
||||
name: Core
|
||||
needs: detect-changes
|
||||
if: ${{ needs.detect-changes.outputs.go-changes == 'true' }}
|
||||
uses: ./.github/workflows/devbox.yml
|
||||
with:
|
||||
install: go
|
||||
test: app
|
||||
build: snrd
|
||||
|
||||
crypto:
|
||||
name: Crypto
|
||||
needs: detect-changes
|
||||
if: ${{ needs.detect-changes.outputs.crypto == 'true' }}
|
||||
uses: ./.github/workflows/devbox.yml
|
||||
with:
|
||||
install: go
|
||||
test: crypto
|
||||
|
||||
docker:
|
||||
name: Docker
|
||||
needs: detect-changes
|
||||
if: ${{ needs.detect-changes.outputs.docker-changes == 'true' }}
|
||||
uses: ./.github/workflows/devbox.yml
|
||||
with:
|
||||
install: go
|
||||
build: docker
|
||||
|
||||
hway:
|
||||
name: Highway
|
||||
needs: detect-changes
|
||||
if: ${{ needs.detect-changes.outputs.hway == 'true' }}
|
||||
uses: ./.github/workflows/devbox.yml
|
||||
with:
|
||||
install: go
|
||||
build: hway
|
||||
|
||||
packages:
|
||||
name: Packages
|
||||
needs: detect-changes
|
||||
if: ${{ needs.detect-changes.outputs.packages-changes == 'true' }}
|
||||
uses: ./.github/workflows/devbox.yml
|
||||
with:
|
||||
install: pnpm
|
||||
test: packages
|
||||
|
||||
web:
|
||||
name: Web
|
||||
needs: detect-changes
|
||||
if: ${{ needs.detect-changes.outputs.web-changes == 'true' }}
|
||||
uses: ./.github/workflows/devbox.yml
|
||||
with:
|
||||
install: pnpm
|
||||
test: web
|
||||
|
||||
x-modules:
|
||||
name: X
|
||||
needs: detect-changes
|
||||
if: ${{ needs.detect-changes.outputs.modules != '[]' && needs.detect-changes.outputs.modules != '' }}
|
||||
strategy:
|
||||
matrix:
|
||||
module: ${{ fromJSON(needs.detect-changes.outputs.modules) }}
|
||||
fail-fast: false
|
||||
uses: ./.github/workflows/devbox.yml
|
||||
with:
|
||||
install: go
|
||||
test: ${{ matrix.module }}
|
||||
Executable
+406
@@ -0,0 +1,406 @@
|
||||
name: Release
|
||||
|
||||
# This workflow handles the complete release process:
|
||||
# 1. Build binaries for multiple platforms (snrd, hway)
|
||||
# 2. Build WASM modules (vault, motor)
|
||||
# 3. Publish to GitHub releases, S3, and package registries
|
||||
# 4. Build and push Docker images for all services
|
||||
# 5. Publish NPM packages
|
||||
# 6. Push protobuf definitions to Buf Schema Registry
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v[0-9]+.[0-9]+.[0-9]+" # ignore rc
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
# Prepare job runs on multiple OS for native builds
|
||||
prepare:
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
goos: linux
|
||||
goarch: amd64
|
||||
- os: ubuntu-latest
|
||||
goos: linux
|
||||
goarch: arm64
|
||||
- os: macos-latest
|
||||
goos: darwin
|
||||
goarch: amd64
|
||||
- os: macos-latest
|
||||
goos: darwin
|
||||
goarch: arm64
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
flags: ""
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
check-latest: true
|
||||
cache-dependency-path: "**/*.sum"
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
go mod download
|
||||
# Build WASM modules
|
||||
make build-motr
|
||||
make build-vault
|
||||
|
||||
# Set flags for workflow dispatch (nightly builds)
|
||||
- if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "flags=--nightly" >> $GITHUB_ENV
|
||||
|
||||
# Generate cache key
|
||||
- shell: bash
|
||||
run: |
|
||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||
|
||||
# Cache the built artifacts
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: dist/${{ matrix.goos }}
|
||||
key: ${{ matrix.goos }}-${{ matrix.goarch }}-${{ env.sha_short }}${{ env.flags }}
|
||||
enableCrossOsArchive: true
|
||||
|
||||
# Run goreleaser in split mode for snrd
|
||||
- name: Run GoReleaser for snrd (Split)
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
distribution: goreleaser-pro
|
||||
version: latest
|
||||
args: release --clean --split --config cmd/snrd/.goreleaser.yml ${{ env.flags }}
|
||||
workdir: cmd/snrd
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
|
||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||
GGOOS: ${{ matrix.goos }}
|
||||
GGOARCH: ${{ matrix.goarch }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
# Run goreleaser in split mode for hway
|
||||
- name: Run GoReleaser for hway (Split)
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
distribution: goreleaser-pro
|
||||
version: latest
|
||||
args: release --clean --split --config cmd/hway/.goreleaser.yml ${{ env.flags }}
|
||||
workdir: cmd/hway
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
|
||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||
GGOOS: ${{ matrix.goos }}
|
||||
GGOARCH: ${{ matrix.goarch }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
# WASM modules build job
|
||||
wasm:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
check-latest: true
|
||||
|
||||
- name: Setup TinyGo
|
||||
uses: acifani/setup-tinygo@v2
|
||||
with:
|
||||
tinygo-version: '0.32.0'
|
||||
|
||||
- name: Build WASM modules
|
||||
run: |
|
||||
# Build vault WASM
|
||||
cd cmd/vault
|
||||
make build
|
||||
cd ../..
|
||||
|
||||
# Build motor WASM
|
||||
cd cmd/motr
|
||||
make build
|
||||
cd ../..
|
||||
|
||||
- name: Run GoReleaser for WASM modules
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
distribution: goreleaser-pro
|
||||
version: latest
|
||||
args: release --clean --config cmd/vault/.goreleaser.yml
|
||||
workdir: cmd/vault
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
|
||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
- name: Run GoReleaser for Motor WASM
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
distribution: goreleaser-pro
|
||||
version: latest
|
||||
args: release --clean --config cmd/motr/.goreleaser.yml
|
||||
workdir: cmd/motr
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
|
||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
# Merge and release job combines all artifacts
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [prepare, wasm]
|
||||
env:
|
||||
flags: ""
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version-file: go.mod
|
||||
check-latest: true
|
||||
cache-dependency-path: "**/*.sum"
|
||||
|
||||
# Set flags for workflow dispatch
|
||||
- if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "flags=--nightly" >> $GITHUB_ENV
|
||||
|
||||
# Generate cache key
|
||||
- shell: bash
|
||||
run: |
|
||||
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
|
||||
|
||||
# Restore all cached artifacts from prepare jobs
|
||||
- name: Restore Linux AMD64 artifacts
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: dist/linux
|
||||
key: linux-amd64-${{ env.sha_short }}${{ env.flags }}
|
||||
enableCrossOsArchive: true
|
||||
|
||||
- name: Restore Linux ARM64 artifacts
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: dist/linux
|
||||
key: linux-arm64-${{ env.sha_short }}${{ env.flags }}
|
||||
enableCrossOsArchive: true
|
||||
|
||||
- name: Restore Darwin AMD64 artifacts
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: dist/darwin
|
||||
key: darwin-amd64-${{ env.sha_short }}${{ env.flags }}
|
||||
enableCrossOsArchive: true
|
||||
|
||||
- name: Restore Darwin ARM64 artifacts
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: dist/darwin
|
||||
key: darwin-arm64-${{ env.sha_short }}${{ env.flags }}
|
||||
enableCrossOsArchive: true
|
||||
|
||||
# Merge and publish the release for snrd
|
||||
- name: Run GoReleaser for snrd (Merge)
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
distribution: goreleaser-pro
|
||||
version: latest
|
||||
args: continue --merge --config cmd/snrd/.goreleaser.yml ${{ env.flags }}
|
||||
workdir: cmd/snrd
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
|
||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
# Merge and publish the release for hway
|
||||
- name: Run GoReleaser for hway (Merge)
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
distribution: goreleaser-pro
|
||||
version: latest
|
||||
args: continue --merge --config cmd/hway/.goreleaser.yml ${{ env.flags }}
|
||||
workdir: cmd/hway
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}
|
||||
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
|
||||
# Protobuf publishing job
|
||||
protobuf:
|
||||
runs-on: ubuntu-latest
|
||||
needs: release
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Buf
|
||||
uses: bufbuild/buf-setup-action@v1
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- name: Push to Buf Schema Registry
|
||||
uses: bufbuild/buf-push-action@v1
|
||||
with:
|
||||
input: proto
|
||||
buf_token: ${{ secrets.BUF_TOKEN }}
|
||||
github_token: ${{ secrets.GH_PAT_TOKEN }}
|
||||
|
||||
# NPM packages publishing job
|
||||
npm:
|
||||
runs-on: ubuntu-latest
|
||||
needs: release
|
||||
if: github.event_name == 'push' # Only on tag push, not workflow_dispatch
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 9
|
||||
run_install: false
|
||||
|
||||
- name: Get pnpm store directory
|
||||
shell: bash
|
||||
run: |
|
||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/cache@v4
|
||||
name: Setup pnpm cache
|
||||
with:
|
||||
path: ${{ env.STORE_PATH }}
|
||||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pnpm-store-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build packages
|
||||
run: pnpm build
|
||||
|
||||
- name: Publish packages
|
||||
run: |
|
||||
# Update package versions to match git tag
|
||||
export VERSION=${GITHUB_REF#refs/tags/v}
|
||||
bash scripts/version-bump.sh sync-packages all
|
||||
|
||||
# Publish to npm
|
||||
pnpm --filter "./packages/*" publish --access public --no-git-checks
|
||||
pnpm --filter "./cli/*" publish --access public --no-git-checks
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
# Docker multi-platform build job
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
needs: release
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- service: snrd
|
||||
dockerfile: cmd/snrd/Dockerfile
|
||||
description: "Sonr blockchain daemon"
|
||||
- service: hway
|
||||
dockerfile: cmd/hway/Dockerfile
|
||||
description: "Highway service - task processor"
|
||||
- service: auth
|
||||
dockerfile: web/auth/Dockerfile
|
||||
description: "Authentication web application"
|
||||
- service: dash
|
||||
dockerfile: web/dash/Dockerfile
|
||||
description: "Dashboard web application"
|
||||
- service: postgres
|
||||
dockerfile: etc/postgres/Dockerfile
|
||||
description: "PostgreSQL with extensions"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GH_PAT_TOKEN }}
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
ghcr.io/sonr-io/${{ matrix.service }}
|
||||
onsonr/${{ matrix.service }}
|
||||
tags: |
|
||||
type=semver,pattern={{version}}
|
||||
type=raw,value=latest
|
||||
type=raw,value=${{ inputs.tag || 'latest' }},enable=${{ github.event_name == 'workflow_dispatch' }}
|
||||
|
||||
- name: Build and push ${{ matrix.service }}
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ${{ matrix.dockerfile }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: |
|
||||
${{ steps.meta.outputs.labels }}
|
||||
org.opencontainers.image.description=${{ matrix.description }}
|
||||
cache-from: type=gha,scope=${{ matrix.service }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.service }}
|
||||
@@ -1,63 +0,0 @@
|
||||
name: Check PR
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read # for TimonVS/pr-labeler-action to read config file
|
||||
pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR
|
||||
|
||||
jobs:
|
||||
verify-pr:
|
||||
name: Test Lints
|
||||
if: github.event_name == 'pull_request'
|
||||
permissions:
|
||||
contents: read # for TimonVS/pr-labeler-action to read config file
|
||||
pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Required to fetch all history for merging
|
||||
- uses: TimonVS/pr-labeler-action@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
|
||||
- name: Trunk Check
|
||||
uses: trunk-io/trunk-action@v1
|
||||
|
||||
test-builds:
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
name: Test Builds
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.24"
|
||||
check-latest: true
|
||||
- name: Run Sonrd Build
|
||||
run: make build
|
||||
|
||||
test-unit:
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
name: Test Unit
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.24"
|
||||
check-latest: true
|
||||
- run: make test-unit
|
||||
@@ -0,0 +1,18 @@
|
||||
name: CI Status
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["PR CI", "Post-Merge Release", "Nightly Snapshot"]
|
||||
types: [completed]
|
||||
|
||||
jobs:
|
||||
report:
|
||||
name: Report CI Status
|
||||
runs-on: builder
|
||||
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
||||
steps:
|
||||
- name: Report Failure
|
||||
run: |
|
||||
echo "❌ Workflow Failed: ${{ github.event.workflow_run.name }}"
|
||||
echo "Branch: ${{ github.event.workflow_run.head_branch }}"
|
||||
echo "Commit: ${{ github.event.workflow_run.head_sha }}"
|
||||
echo "URL: ${{ github.event.workflow_run.html_url }}"
|
||||
@@ -1,42 +0,0 @@
|
||||
name: Merge Group
|
||||
|
||||
on:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read # for TimonVS/pr-labeler-action to read config file
|
||||
pull-requests: write # for TimonVS/pr-labeler-action to add labels in PR
|
||||
|
||||
jobs:
|
||||
test-race:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'merge_group'
|
||||
name: Test Race
|
||||
continue-on-error: true
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
- name: Install devbox
|
||||
uses: jetify-com/devbox-install-action@v0.12.0
|
||||
- run: make test-race
|
||||
|
||||
test-cover:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'merge_group'
|
||||
name: Test Coverage
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: onsonr/sonr
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.23"
|
||||
check-latest: true
|
||||
- run: make test-cover
|
||||
@@ -0,0 +1,61 @@
|
||||
name: PR CI
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
concurrency:
|
||||
group: pr-${{ github.head_ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
DEVBOX_VERSION: 0.16.0
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
name: Validate & Test
|
||||
runs-on: builder # Self-hosted runner
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Required for github-env.sh comparisons
|
||||
# Cache can be local on self-hosted runner for better performance
|
||||
- name: Cache Dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/.cache/go-build
|
||||
~/.local/share/pnpm/store
|
||||
~/.devbox
|
||||
key: deps-builder-${{ hashFiles('go.sum', 'pnpm-lock.yaml', 'devbox.json') }}
|
||||
restore-keys: deps-builder-
|
||||
|
||||
- name: Install Dependencies
|
||||
run: devbox install
|
||||
|
||||
- name: Test Affected Scopes
|
||||
run: |
|
||||
echo "🔍 Analyzing changes..."
|
||||
./scripts/github-env.sh git-context
|
||||
echo ""
|
||||
devbox run test
|
||||
|
||||
- name: Build Affected Scopes
|
||||
run: devbox run build
|
||||
|
||||
- name: Verify Build Artifacts
|
||||
run: |
|
||||
# Verify critical build outputs exist
|
||||
if [ -d "build/" ]; then
|
||||
ls -la build/
|
||||
fi
|
||||
|
||||
# Cleanup workspace for self-hosted runner
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: |
|
||||
# Clean build artifacts to prevent disk fill
|
||||
make clean || true
|
||||
# Keep caches but remove build outputs
|
||||
rm -rf dist/ build/ || true
|
||||
Reference in New Issue
Block a user