[surfacer.postgres] Switch to newer pgx postgres driver #1883
Workflow file for this run
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 and Test | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'docs/**' | |
- '.github/workflows/hugo.yml' | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- '.github/workflows/hugo.yml' | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to run workflow for' | |
required: true | |
release: | |
types: [published] | |
jobs: | |
build-and-test: | |
name: Build and Test | |
runs-on: ${{ matrix.os }} | |
env: | |
PING_HOSTS_V4: 127.0.1.1,localhost | |
PING_HOSTS_V6: localhost | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: Check out code into the Go module directory | |
if: github.event_name != 'workflow_dispatch' | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Check out code into the Go module directory | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.tag }} | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
cache: true | |
id: go | |
- name: Set DISABLE_IPV6_TESTS on Windows OS | |
if: matrix.os == 'windows-latest' | |
run: echo "DISABLE_IPV6_TESTS=yes" >> $env:GITHUB_ENV | |
- name: Get dependencies | |
run: go get -v -t -d ./... | |
- name: Build | |
run: go build -v . | |
- name: Set up ubuntu for testing | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo sudo sysctl -w net.ipv4.ping_group_range="0 500000" | |
- name: Test on ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
go install gotest.tools/gotestsum@latest | |
gotestsum --jsonfile=report.json --rerun-fails --packages=./... -- ${{ env.EXTRA_TEST_FLAGS }} -race -covermode=atomic -coverprofile=cover.out | |
- name: Test on non-ubuntu | |
if: matrix.os != 'ubuntu-latest' | |
run: | | |
go install gotest.tools/gotestsum@latest | |
gotestsum --rerun-fails --packages=./... -- ${{ env.EXTRA_TEST_FLAGS }} -race -covermode=atomic | |
- name: SonarCloud Scan | |
if: matrix.os == 'ubuntu-latest' && github.repository == 'cloudprober/cloudprober' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
- name: Privileged ping tests. | |
if: matrix.os != 'windows-latest' | |
run: | | |
go test github.com/cloudprober/cloudprober/probes/ping -c | |
sudo PING_HOSTS_V4=${{ env.PING_HOSTS_V4 }} PING_HOSTS_V6=${{ env.PING_HOSTS_V6 }} ./ping.test -test.v -test.run ^TestRunProbeRealICMP$ | |
- name: Example config tests | |
if: matrix.os == 'ubuntu-latest' | |
run: tools/test_example_configs.sh | |
- name: Upload test and coverage reports | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-reports | |
path: | | |
report.json | |
cover.out | |
build-binaries: | |
name: Build binaries | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- name: Check out code into the Go module directory | |
if: ${{ !contains(github.event_name, 'workflow_dispatch') }} | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Check out code into the Go module directory | |
if: ${{ contains(github.event_name, 'workflow_dispatch') }} | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.tag }} | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.mod | |
cache: true | |
id: go | |
- run: make cloudprober-linux-{amd64,arm64,armv7} | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
- run: make cloudprober-macos-{amd64,arm64} cloudprober-windows-amd64 | |
if: ${{ matrix.os == 'macos-latest' }} | |
- name: Upload cloudprober dist | |
uses: actions/upload-artifact@v2 | |
with: | |
name: cloudprober-${{ matrix.os }}-dist | |
path: cloudprober-* | |
build-dist: | |
name: Build cloudprober release | |
needs: [build-and-test, build-binaries] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
if: ${{ !contains(github.event_name, 'workflow_dispatch') }} | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Check out code into the Go module directory | |
if: ${{ contains(github.event_name, 'workflow_dispatch') }} | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.tag }} | |
- name: Download ubuntu cloudprober binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: cloudprober-ubuntu-latest-dist | |
- name: Download macos cloudprober binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: cloudprober-macos-latest-dist | |
- run: make dist | |
- name: Upload cloudprober release | |
uses: actions/upload-artifact@v2 | |
with: | |
name: cloudprober-release-binaries | |
path: cloudprober-*.zip | |
build_and_push_docker_multiarch: | |
name: Build and push multiarch docker image | |
if: github.repository == 'cloudprober/cloudprober' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) | |
needs: [build-and-test, build-binaries] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
if: ${{ !contains(github.event_name, 'workflow_dispatch') }} | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Check out code into the Go module directory | |
if: ${{ contains(github.event_name, 'workflow_dispatch') }} | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.tag }} | |
- name: Download cloudprober binary | |
uses: actions/download-artifact@v2 | |
with: | |
name: cloudprober-ubuntu-latest-dist | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.docker_login }} | |
password: ${{ secrets.docker_pass }} | |
- name: Login to GHCR | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: | | |
cp cloudprober-linux-amd64 cloudprober | |
ls -R cloudprober* | |
chmod a+rx cloudprober cloudprober-* | |
- name: Build and push release Docker Image (main-dockerhub) | |
run: make docker_multiarch | |
- name: Build and push release Docker Image (main-ghcr) | |
run: make docker_multiarch DOCKER_IMAGE=ghcr.io/cloudprober/cloudprober | |
- name: Build and push release Docker Image (contrib) | |
run: make -C contrib docker_multiarch | |
- name: Build and push release Docker Image (contrib-ghcr) | |
run: make -C contrib docker_multiarch DOCKER_IMAGE=ghcr.io/cloudprober/cloudprober-contrib | |
pre-release: | |
name: Upload pre-release binaries | |
if: github.ref == 'refs/heads/master' | |
needs: [build-dist] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download cloudprober release | |
uses: actions/download-artifact@v2 | |
with: | |
name: cloudprober-release-binaries | |
- run: ls -R * | |
- run: | | |
mv cloudprober*-linux-arm64.zip cloudprober-tip-linux-arm64.zip | |
mv cloudprober*-linux-armv7.zip cloudprober-tip-linux-armv7.zip | |
mv cloudprober*-linux-x86_64.zip cloudprober-tip-linux-x86_64.zip | |
mv cloudprober*-macos-arm64.zip cloudprober-tip-macos-arm64.zip | |
mv cloudprober*-macos-x86_64.zip cloudprober-tip-macos-x86_64.zip | |
mv cloudprober*-windows-x86_64.zip cloudprober-tip-windows-x86_64.zip | |
- uses: pyTooling/Actions/releaser@r0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
cloudprober-*.zip |