Skip to content

[*] deprecate --direct-os-stats flag #1749

[*] deprecate --direct-os-stats flag

[*] deprecate --direct-os-stats flag #1749

Workflow file for this run

name: Build and Test
permissions:
contents: write
packages: write
pages: write
on:
push:
branches:
- master
pull_request:
paths-ignore: ['docs/**', 'mkdocs.yml']
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build and Lint
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Set up Golang
uses: actions/setup-go@v6
with:
go-version: '1.25'
cache-dependency-path: 'go.sum'
- name: Setup Protobuf
uses: ./.github/actions/setup-protobuf
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
- name: Cache npm packages
uses: actions/cache@v4
with:
path: |
internal/webui/node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Build
run: |
cd internal/webui
yarn install --network-timeout 100000 && yarn build
cd -
go generate ./api/pb/
go build ./cmd/pgwatch
- name: Upload webui as artifact
uses: actions/upload-artifact@v5
with:
name: webui-build
path: internal/webui/build
- name: GolangCI-Lint
uses: golangci/golangci-lint-action@v9
with:
version: latest
test:
if: true # false to skip job during debug
needs: build
runs-on: ubuntu-latest
name: Test
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Set up Golang
uses: actions/setup-go@v6
with:
go-version: '1.25'
cache-dependency-path: 'go.sum'
- name: Download webui artifact
uses: actions/download-artifact@v6
with:
name: webui-build
path: internal/webui/build
- name: Setup Protobuf
uses: ./.github/actions/setup-protobuf
- name: Test
run: |
go generate ./api/pb/
go test -failfast -v -timeout=300s -p 1 -coverprofile=profile.cov ./cmd/... ./internal/...
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
file: profile.cov
goreleaser:
if: true # false to skip job during debug
needs: [build, test]
runs-on: ubuntu-latest
name: GoReleaser
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Set up Golang
uses: actions/setup-go@v6
with:
go-version: '1.25'
cache-dependency-path: 'go.sum'
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
- name: Setup Protobuf
uses: ./.github/actions/setup-protobuf
- name: Generate protobuf files
run: go generate ./api/pb/
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --snapshot --skip=publish --clean
test-docker-images:
if: true # false to skip job during debug
needs: [build, test, goreleaser]
name: Test Docker Image Build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Prepare build metadata
id: meta
run: |
echo "GIT_HASH=${{ github.sha }}" >> $GITHUB_OUTPUT
echo "GIT_TIME=$(git show -s --format=%cI HEAD)" >> $GITHUB_OUTPUT
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- name: Test build Docker image (fast, amd64 only)
uses: ./.github/actions/build-docker
with:
dockerfile: docker/Dockerfile
image-name: cybertecpostgresql/pgwatch
platforms: linux/amd64
push: 'false'
cache-scope: test-build
build-args: |
GIT_HASH=${{ steps.meta.outputs.GIT_HASH }}
GIT_TIME=${{ steps.meta.outputs.GIT_TIME }}
VERSION=${{ steps.meta.outputs.VERSION }}
build-docs:
if: true # false to skip job during debug
needs: [build, test]
name: Build Docs
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5
- name: Configure Git
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Set up Golang
uses: actions/setup-go@v6
with:
go-version: '1.25'
- name: Set up gopages
run: go install github.com/johnstarich/go/gopages@v0.1.29
- name: Build Developer Docs
run: gopages -out "docs/godoc" -base "/devel/godoc" -internal
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.12
- name: Install dependencies
run: pip install mike mkdocs-material mkdocs-glightbox
- name: Check if we should push to gh-pages
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: |
git fetch origin gh-pages --depth=1
echo "push_opt=--push" >> $GITHUB_ENV
- name: Build mkdocs
run: mike deploy ${{ env.push_opt }} devel