feat: login working #16
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: Go | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21.3' | |
- name: Install psql | |
run: sudo apt-get -y install postgresql-client | |
- name: Create tables | |
run: | | |
set -e | |
PGPASSWORD=postgres psql -h localhost -U postgres -d postgres -f notification/pkg/model/notification.sql | |
PGPASSWORD=postgres psql -h localhost -U postgres -d postgres -f user/pkg/model/user.sql | |
- name: Run go tests User service | |
run: go test ./user/... -v -cover | |
- name: Run go tests Notification service | |
run: go test ./notification/... -v -cover | |
- name: Run go tests API Gateway | |
run: go test ./api-gateway/... -v -cover | |
- name: Build and test User service | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
workdir: ./user/cmd | |
args: build --clean --snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and test Notification service | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
workdir: ./notification/cmd | |
args: build --clean --snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and test API Gateway | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
workdir: ./api-gateway/cmd | |
args: build --clean --snapshot | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
docker: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build User service Docker Image | |
uses: docker/build-push-action@v3 | |
with: | |
context: "{{defaultContext}}:user" | |
push: false | |
- name: Build Notification service Docker Image | |
uses: docker/build-push-action@v3 | |
with: | |
context: "{{defaultContext}}:notification" | |
push: false | |
- name: Build API Gateway Docker Image | |
uses: docker/build-push-action@v3 | |
with: | |
context: "{{defaultContext}}:api-gateway" | |
push: false | |