twitter snowflake uuid generator #11
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: TinyURL CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_USER: test | |
POSTGRES_PASSWORD: 123 | |
POSTGRES_DB: tinyurl_test | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
redis: | |
image: redis:latest | |
ports: | |
- 6379:6379 | |
options: --entrypoint redis-server | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.3' | |
- name: Install dependencies | |
working-directory: ./tinyURL | |
run: go mod download | |
- name: Run integration tests | |
working-directory: ./tinyURL | |
run: go test ./tests/ -v | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Gos | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.3' | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
working-directory: ./tinyURL | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
needs: [test, lint] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22.3' | |
- name: Build | |
working-directory: ./tinyURL | |
run: go build -v ./... |