This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
Merge pull request #20 from danicaceres1998/upgrade-packages-and-refa… #3
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: gocardless/pgreplay-go/build-integration | |
on: | |
push: | |
branches: | |
- master | |
env: | |
GITHUB_TOKEN: xxxx599f | |
jobs: | |
unit-integration: | |
defaults: | |
run: | |
working-directory: "/go/src/github.com/gocardless/pgreplay-go" | |
runs-on: ubuntu-latest | |
container: | |
image: golang:1.21.4 | |
env: | |
PGHOST: 127.0.0.1 | |
PGUSER: postgres | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_DB: pgreplay_test | |
POSTGRES_PASSWORD: '' | |
steps: | |
- uses: actions/[email protected] | |
- name: Install ginkgo test runner | |
run: go get github.com/onsi/ginkgo/ginkgo | |
- name: Install Postgres | |
run: apt-get update && apt-get install -y postgresql-client libpq-dev | |
- name: Create test database | |
run: make recreatedb | |
- name: Run tests | |
run: ginkgo -race -r | |
release: | |
if: github.ref == 'refs/heads/master' | |
defaults: | |
run: | |
working-directory: "/go/src/github.com/gocardless/pgreplay-go" | |
runs-on: ubuntu-latest | |
container: | |
image: golang:1.21.4 | |
env: | |
PGHOST: 127.0.0.1 | |
PGUSER: postgres | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_DB: pgreplay_test | |
POSTGRES_PASSWORD: '' | |
needs: | |
- unit-integration | |
steps: | |
- uses: actions/[email protected] | |
- name: Release | |
run: |- | |
CURRENT_VERSION="v$(cat VERSION)" | |
if [[ $(git tag -l "${CURRENT_VERSION}") == "${CURRENT_VERSION}" ]]; then | |
echo "Version ${CURRENT_VERSION} is already released" | |
exit 0 | |
fi | |
curl -L -o /tmp/goreleaser_Linux_x86_64.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v0.101.0/goreleaser_Linux_x86_64.tar.gz | |
tar zxf /tmp/goreleaser_Linux_x86_64.tar.gz -C /tmp | |
git log --pretty=oneline --abbrev-commit --no-decorate --no-color "$(git describe --tags --abbrev=0)..HEAD" -- pkg cmd vendor internal > /tmp/release-notes | |
git tag "${CURRENT_VERSION}" | |
git push --tags | |
/tmp/goreleaser --rm-dist --release-notes /tmp/release-notes |