update push workflow #2
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: verify | |
on: | |
workflow_call: | |
push: | |
branches: | |
- "**" | |
- "!main" | |
env: | |
POSTMAND_TEST_DATABASE_URL: "postgres://user:pass@localhost:5432/postmand_test?sslmode=disable" | |
jobs: | |
verify: | |
name: Test | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:12-alpine | |
env: | |
POSTGRES_DB: postmand_test | |
POSTGRES_USER: user | |
POSTGRES_PASSWORD: pass | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Set up Go 1.21 | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Set cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Get dependencies | |
run: go mod download | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
skip-pkg-cache: true | |
skip-build-cache: true | |
- name: Install just | |
run: sudo snap install --edge --classic just | |
- name: Run Tests | |
run: just db-test-migrate && just test |