Skip to content

Nick/neos 301 add api key service from protos #481

Nick/neos 301 add api key service from protos

Nick/neos 301 add api key service from protos #481

Workflow file for this run

on:
pull_request:
paths:
- backend/**
name: Backend
jobs:
golangci:
name: golang-lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --timeout=5m
working-directory: backend
buf:
name: buf-lint
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- name: Retrieve Buf Version
run: |
VER=$(cat BUF_VERSION)
echo "BUF_VERSION=$VER" >> $GITHUB_ENV
- name: Setup Buf
uses: bufbuild/[email protected]
with:
version: ${{ env.BUF_VERSION }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Buf Lint
uses: bufbuild/buf-lint-action@v1
with:
input: backend
test:
name: test
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum
- name: Test
run: |
go test -race -coverprofile=coverage.out -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
sqlcdiff:
name: sqlc-diff
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Retrieve SQLC Version
run: |
VER=$(cat SQLC_VERSION)
echo "SQLC_VERSION=$VER" >> $GITHUB_ENV
- uses: sqlc-dev/setup-sqlc@v4
with:
sqlc-version: ${{ env.SQLC_VERSION }}
- run: sqlc diff
sqlcvet:
name: sqlc-vet
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
services:
postgres:
image: "postgres:15"
ports:
- 5432:5432
env:
POSTGRES_DB: nucleus
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Patch sqlc.yaml with db-prepare lint
uses: mikefarah/[email protected]
with:
cmd: sh ./backend/hack/sqlc-prepare-patch.sh postgresql://postgres:postgres@localhost:5432/nucleus ./backend/sqlc.yaml
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum
- name: Install golang-migrate
run: make install-go-tools
- name: Run migrations on database
env:
PG_PASSWORD: postgres
run: ./hack/migrate.sh up
- name: Retrieve SQLC Version
run: |
VER=$(cat SQLC_VERSION)
echo "SQLC_VERSION=$VER" >> $GITHUB_ENV
- uses: sqlc-dev/setup-sqlc@v4
with:
sqlc-version: ${{ env.SQLC_VERSION }}
- run: sqlc vet