feature/pos-syncing-and-steady-state #4222
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: ci | |
on: | |
pull_request: {} | |
push: | |
branches: | |
- main | |
jobs: | |
go-fmt: | |
name: go-fmt | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: "1.20" | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
# Fail if go-fmt recommends any changes. | |
- name: Run go fmt | |
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi | |
go-test-postgres: | |
name: go-test-postgres | |
runs-on: ubuntu-20.04 | |
env: | |
# These dummy values are used for testing purposes only. | |
POSTGRES_URI: postgresql://admin:admin@localhost:5432/admin | |
services: | |
postgres: | |
image: postgres:14.2-alpine3.15 | |
env: | |
# These dummy values are used for testing purposes only. | |
POSTGRES_DB: admin | |
POSTGRES_PASSWORD: admin | |
POSTGRES_USER: admin | |
# Set health checks to wait until postgres has started. | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: "1.20" | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
- name: Cache dependencies | |
id: cache-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
# Install dependencies if not found in cache. | |
- name: Install dependencies | |
if: steps.cache-dependencies.outputs.cache-hit != 'true' | |
run: go mod download && go install | |
- name: Build package | |
run: go build | |
- name: Run migrations | |
run: go run scripts/migrate.go migrate | |
- name: Run go test | |
run: >- | |
go test -run TestAssociations -v ./lib && | |
go test -run TestDAOCoinLimitOrder -v ./lib && | |
go test -run TestFreezingPosts -v ./lib && | |
go test -run TestBalanceModelAssociations -v ./lib && | |
go test -run TestPGGenesisBlock -v ./lib | |
- name: Rollback migrations | |
run: go run scripts/migrate.go rollback |