From af572254f5f47761c12efea6f25c77a49a8c4005 Mon Sep 17 00:00:00 2001 From: Manuel Carrer Date: Thu, 14 Nov 2024 11:05:29 +0100 Subject: [PATCH] Add go ci --- .github/workflows/go_ci.yml | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/go_ci.yml diff --git a/.github/workflows/go_ci.yml b/.github/workflows/go_ci.yml new file mode 100644 index 0000000..e70bdfc --- /dev/null +++ b/.github/workflows/go_ci.yml @@ -0,0 +1,50 @@ +name: Continuous integration for Go migration package + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed + paths: + - 'migrations' + +jobs: + build-and-test: + name: Build and test + runs-on: ubuntu-latest + + defaults: + run: + working-directory: migrations + + services: + postgres: + image: postgres + # Provide the password for postgres + env: + POSTGRES_PASSWORD: postgres + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + steps: + - uses: actions/checkout@v5 + + - name: Setup Go 1.22.x + uses: actions/setup-go@v5 + with: + go-version: '1.22.x' + cache-dependency-path: migrations/go.sum + + - name: Install dependencies + run: go get + + - name: Build + run: go build -v ./... + + - name: Run tests + run: go test -v ./...