fix(ci): Copy not move migrate tool #27
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: push | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:12-alpine | |
env: | |
POSTGRES_PASSWORD: secret | |
POSTGRES_USER: root | |
POSTGRES_DB: users | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Set up Golang | |
uses: actions/setup-go@v4 | |
- name: Cache migrate exe | |
id: cache-migrate | |
uses: actions/cache@v3 | |
with: | |
path: migrate | |
key: ${{ runner.os }}-migrate-exe | |
- name: Download migrate tool | |
if: steps.cache-migrate.outputs.cache-hit != 'true' | |
run: > | |
curl -L https://github.com/golang-migrate/migrate/releases/download/v4.14.1/migrate.linux-amd64.tar.gz | |
| tar xvz | |
&& mv migrate.linux-amd64 migrate | |
&& echo "faaf3c4c96b6a5fb55a1b29888deb473aacbb47a858dafa7e586e1587c968265 migrate" | |
| sha256sum -c - | |
- name: Move migrate to /usr/bin | |
run: sudo cp migrate /usr/bin/migrate | |
- name: Prepare PostgreSQL | |
run: > | |
migrate | |
-path db/migrations/ | |
-database "postgresql://root:secret@localhost:5432/users?sslmode=disable" | |
-verbose up | |
- name: Run tests | |
run: go test -coverprofile /dev/null ./... | |
lint: | |
name: GolangCI-Linter | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Run linter | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
only-new-issues: true | |
SQLCCheck: | |
name: SQLC checks | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Prepare SQLC | |
uses: sqlc-dev/setup-sqlc@v3 | |
with: | |
sqlc-version: '1.19.1' | |
- name: Check autogenerated code | |
run: sqlc diff | |
- name: Vet SQL related code | |
run: sqlc vet |