Run make format #813
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: Run CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14.8 | |
env: | |
POSTGRES_HOST_AUTH_METHOD: trust | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 0.5s | |
--health-timeout 2m | |
--health-retries 50 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
# Allows for file comparison across commits | |
fetch-depth: 0 | |
- name: Check go.mod | |
run: | | |
go get | |
if [[ $(git status --porcelain) ]]; then | |
echo "Please run 'go get' and commit the changes to go.mod and go.sum" | |
exit 1 | |
fi | |
- name: Check format | |
run: | | |
make format | |
if [[ $(git status --porcelain) ]]; then | |
echo "Please run 'make format' and commit the changes" | |
exit 1 | |
fi | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55.2 | |
- name: Ensure ordering of migration files is preserved | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
./scripts/check-migrations-ordering.sh origin/${{ github.base_ref }} | |
- name: Run tests and check code coverage | |
env: | |
GO_ENV: test | |
DB_NAME: sa_stories_test | |
run: | | |
make db_create | |
make db_migrate | |
make test | |
make db_drop db_create db_migrate | |
make coverage | |
- name: Coveralls | |
uses: coverallsapp/github-action@v2 | |
with: | |
file: coverage.out | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build server | |
run: | | |
make build |