Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/tools/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module github.com/zx06/xsql/.github/tools

go 1.25.0

require github.com/rhysd/actionlint v1.7.7

require (
github.com/bmatcuk/doublestar/v4 v4.8.0 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/mattn/go-shellwords v1.0.12 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.29.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
30 changes: 30 additions & 0 deletions .github/tools/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
github.com/bmatcuk/doublestar/v4 v4.8.0 h1:DSXtrypQddoug1459viM9X9D3dp1Z7993fw36I2kNcQ=
github.com/bmatcuk/doublestar/v4 v4.8.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
github.com/rhysd/actionlint v1.7.7 h1:0KgkoNTrYY7vmOCs9BW2AHxLvvpoY9nEUzgBHiPUr0k=
github.com/rhysd/actionlint v1.7.7/go.mod h1:AE6I6vJEkNaIfWqC2GNE5spIJNhxf8NCtLEKU4NnUXg=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
3 changes: 3 additions & 0 deletions .github/tools/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package tools

import _ "github.com/rhysd/actionlint/cmd/actionlint"

Check warning on line 3 in .github/tools/tools.go

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a comment explaining why this blank import is needed.

See more on https://sonarcloud.io/project/issues?id=zx06_xsql&issues=AaEkjKEDAr7Y89NJSWyL&open=AaEkjKEDAr7Y89NJSWyL&pullRequest=83
41 changes: 37 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,40 @@ jobs:
shell: bash
run: gotestsum --junitfile test-results.xml -- -v -race -coverprofile=coverage.txt -covermode=atomic ./...

- name: Detect Codecov token
id: codecov_token
shell: bash
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
if [ -n "$CODECOV_TOKEN" ]; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "present=false" >> "$GITHUB_OUTPUT"
echo "Skipping Codecov upload: CODECOV_TOKEN is not available (e.g. fork or Dependabot PR)."
fi

- name: Upload test results to Codecov
if: steps.codecov_token.outputs.present == 'true'
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: test-results.xml
flags: unittests
report_type: test_results
fail_ci_if_error: false
fail_ci_if_error: true
skip_validation: true

- name: Upload coverage to Codecov
if: steps.codecov_token.outputs.present == 'true'
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.txt
flags: unittests
name: codecov-${{ matrix.os }}
fail_ci_if_error: false
fail_ci_if_error: true
skip_validation: true
verbose: true

integration:
Expand Down Expand Up @@ -150,23 +167,39 @@ jobs:
XSQL_TEST_PG_DSN: "postgres://postgres:postgres@127.0.0.1:5432/testdb?sslmode=disable"
run: gotestsum --junitfile e2e-test-results.xml -- -v -tags=e2e -coverprofile=coverage-e2e.txt -covermode=atomic -coverpkg=github.com/zx06/xsql/internal/... ./tests/e2e/...

- name: Detect Codecov token
id: codecov_token
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
if [ -n "$CODECOV_TOKEN" ]; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "present=false" >> "$GITHUB_OUTPUT"
echo "Skipping Codecov upload: CODECOV_TOKEN is not available (e.g. fork or Dependabot PR)."
fi

- name: Upload integration test results to Codecov
if: steps.codecov_token.outputs.present == 'true'
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: integration-test-results.xml,e2e-test-results.xml
flags: integration,e2e
report_type: test_results
fail_ci_if_error: false
fail_ci_if_error: true
skip_validation: true

- name: Upload integration coverage to Codecov
if: steps.codecov_token.outputs.present == 'true'
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage-integration.txt,coverage-e2e.txt
flags: integration,e2e
name: codecov-integration
fail_ci_if_error: false
fail_ci_if_error: true
skip_validation: true
verbose: true
disable_search: true

Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/release-dry-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Release dry run

on:
pull_request:
paths:
- ".github/workflows/release*.yml"
- ".goreleaser.yaml"
- "npm/**"
- "scripts/npm-publish.js"
- "scripts/release-smoke.js"
- "scripts/release-artifacts.js"
- ".github/tools/**"
workflow_dispatch:

permissions:
contents: read

jobs:
actionlint:
name: actionlint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: "1.25"
cache: false

- name: Run actionlint
env:
WORKFLOW_DIR: ${{ github.workspace }}/.github/workflows
run: |
shopt -s nullglob
mapfile -t workflow_files < <(printf '%s\n' "$WORKFLOW_DIR"/*.yml "$WORKFLOW_DIR"/*.yaml)
cd .github/tools
go run github.com/rhysd/actionlint/cmd/actionlint -color "${workflow_files[@]}"

build:
name: GoReleaser snapshot build
runs-on: ubuntu-latest
needs: actionlint
permissions:
contents: read
actions: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
with:
go-version: "1.25"
cache: true

- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"
cache: "npm"
cache-dependency-path: webui/package-lock.json

- name: GoReleaser snapshot build
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0
with:
distribution: goreleaser
version: "~> v2"
args: build --snapshot --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload dist artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: goreleaser-dist
path: dist/
retention-days: 3

smoke:
name: Release smoke tests
needs: build
permissions:
contents: read
actions: read
uses: ./.github/workflows/release-smoke-reusable.yml
with:
dist-artifact-name: goreleaser-dist
89 changes: 89 additions & 0 deletions .github/workflows/release-smoke-reusable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Release smoke (reusable)

on:
workflow_call:
inputs:
dist-artifact-name:
description: Artifact name containing the GoReleaser dist/ directory
required: true
type: string

permissions:
contents: read
actions: read

jobs:
smoke-binary:
name: Binary smoke (${{ matrix.label }})
runs-on: ${{ matrix.runner }}
permissions:
contents: read
actions: read
strategy:
fail-fast: false
matrix:
include:
- label: linux-amd64
runner: ubuntu-latest
goos: linux
goarch: amd64
- label: linux-arm64
runner: ubuntu-24.04-arm
goos: linux
goarch: arm64
- label: darwin-arm64
runner: macos-latest
goos: darwin
goarch: arm64
- label: windows-amd64
runner: windows-latest
goos: windows
goarch: amd64
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"

- name: Download GoReleaser dist
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ${{ inputs.dist-artifact-name }}
path: dist

- name: Smoke test binary
shell: bash
env:
SMOKE_GOOS: ${{ matrix.goos }}
SMOKE_GOARCH: ${{ matrix.goarch }}
run: node scripts/release-smoke.js binary dist "$SMOKE_GOOS" "$SMOKE_GOARCH"

smoke-npm:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
name: npm smoke (${{ matrix.os }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
actions: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: "24"

- name: Download GoReleaser dist
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: ${{ inputs.dist-artifact-name }}
path: dist

- name: Smoke test npm package
shell: bash
run: node scripts/release-smoke.js npm dist
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Loading
Loading