[*] renormalize line endings (#604) #887
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Go Build & Test | |
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@v4 | |
- name: Set up Golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
cache-dependency-path: 'go.sum' | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
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 build ./cmd/pgwatch | |
- name: Upload webui as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: webui-build | |
path: internal/webui/build | |
- name: GolangCI-Lint | |
uses: golangci/golangci-lint-action@v6 | |
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@v4 | |
- name: Set up Golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
cache-dependency-path: 'go.sum' | |
- name: Download webui artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: webui-build | |
path: internal/webui/build | |
- name: Test | |
run: | | |
go test -failfast -v -timeout=300s -p 1 -coverprofile=profile.cov ./... | |
- name: Coveralls | |
uses: coverallsapp/github-action@v2 | |
with: | |
file: profile.cov | |
goreleaser: | |
if: true # false to skip job during debug | |
needs: build | |
runs-on: ubuntu-latest | |
name: GoReleaser | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
cache-dependency-path: 'go.sum' | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- 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 | |
name: Build Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Build Docker Image | |
shell: bash | |
run: | | |
docker build \ | |
--build-arg GIT_TIME=`git show -s --format=%cI HEAD` \ | |
--build-arg GIT_HASH=`git show -s --format=%H HEAD` \ | |
--build-arg VERSION=`git rev-parse --abbrev-ref HEAD` \ | |
-t cybertecpostgresql/pgwatch:latest \ | |
-f docker/Dockerfile . | |
build-docs: | |
if: true # false to skip job during debug | |
needs: build | |
name: Build Docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- 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@v5 | |
with: | |
go-version: '1.23' | |
- name: Set up gopages | |
run: go install github.com/johnstarich/go/[email protected] | |
- name: Build Developer Docs | |
run: gopages -out "docs/godoc" -base "/godoc" -internal | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
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 |