This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow gocardless/pgreplay-go/build-integration (#12)
- Loading branch information
Sam Robson
authored
Nov 7, 2023
1 parent
8afdaf7
commit 35f63e4
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
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.13 | ||
env: | ||
PGHOST: 127.0.0.1 | ||
PGUSER: postgres | ||
services: | ||
postgres: | ||
image: postgres:11.2 | ||
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.13 | ||
env: | ||
PGHOST: 127.0.0.1 | ||
PGUSER: postgres | ||
services: | ||
postgres: | ||
image: postgres:11.2 | ||
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 |