2021-11-08 17:08:06 +00:00
|
|
|
name: CI
|
2021-07-09 06:19:58 +00:00
|
|
|
|
2021-07-23 15:39:23 +00:00
|
|
|
on:
|
2021-07-09 06:19:58 +00:00
|
|
|
push:
|
2022-09-03 13:37:44 +00:00
|
|
|
branches: ["master"]
|
2021-07-09 06:19:58 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
api-build:
|
2021-11-08 17:08:06 +00:00
|
|
|
name: API
|
2021-07-09 06:19:58 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-09-03 13:37:44 +00:00
|
|
|
container: golang:1.19-bullseye
|
2021-09-26 19:14:03 +00:00
|
|
|
timeout-minutes: 15
|
2021-07-17 11:27:26 +00:00
|
|
|
services:
|
2022-09-03 13:37:44 +00:00
|
|
|
bucket:
|
|
|
|
image: minio/minio:edge-cicd
|
2021-07-17 11:27:26 +00:00
|
|
|
env:
|
2022-09-03 13:37:44 +00:00
|
|
|
MINIO_ROOT_USER: root
|
|
|
|
MINIO_ROOT_PASSWORD: verysecurepassword
|
|
|
|
MINIO_ACCESS_KEY: minio_access_key
|
|
|
|
MINIO_SECRET_KEY: minio_access_key
|
2021-07-17 11:27:26 +00:00
|
|
|
ports:
|
2022-09-03 13:37:44 +00:00
|
|
|
- 9000:9000
|
|
|
|
options: >-
|
|
|
|
--health-cmd "curl -f http://bucket:9000/minio/health/live"
|
|
|
|
--health-interval 45s
|
|
|
|
--health-timeout 30s
|
|
|
|
--health-retries 10
|
|
|
|
--health-start-period 120s
|
|
|
|
volumes:
|
|
|
|
- minio-data:/data
|
2021-07-17 11:27:26 +00:00
|
|
|
redis:
|
2022-09-03 13:52:05 +00:00
|
|
|
image: redis:6-bullseye
|
2021-07-17 11:27:26 +00:00
|
|
|
ports:
|
|
|
|
- 6379:6379
|
2021-07-09 06:19:58 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./api
|
2021-07-17 11:27:26 +00:00
|
|
|
|
2021-07-09 06:19:58 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Installling dependencies
|
2021-11-08 17:08:06 +00:00
|
|
|
run: go mod download
|
2021-07-17 11:27:26 +00:00
|
|
|
|
2021-07-09 06:19:58 +00:00
|
|
|
- name: Build
|
2021-07-14 18:24:47 +00:00
|
|
|
run: go build main.go
|
2021-07-17 11:27:26 +00:00
|
|
|
|
2021-11-08 15:40:17 +00:00
|
|
|
- name: Run test & coverage
|
2022-09-03 13:37:44 +00:00
|
|
|
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
|
2021-11-08 15:40:17 +00:00
|
|
|
env:
|
|
|
|
ENV: development
|
|
|
|
PORT: 5000
|
2022-09-03 14:09:26 +00:00
|
|
|
MINIO_HOST: bucket:9000
|
2022-09-03 14:15:08 +00:00
|
|
|
MINIO_ACCESS_ID: root
|
|
|
|
MINIO_SECRET_KEY: verysecurepassword
|
2021-11-08 15:40:17 +00:00
|
|
|
REDIS_URL: redis://@redis:6379
|
2021-07-09 06:19:58 +00:00
|
|
|
|
|
|
|
- name: Initialize CodeQL
|
|
|
|
uses: github/codeql-action/init@v1
|
|
|
|
with:
|
|
|
|
languages: go
|
|
|
|
|
|
|
|
- name: Perform CodeQL Analysis
|
2021-07-15 06:51:39 +00:00
|
|
|
uses: github/codeql-action/analyze@v1
|
|
|
|
|
|
|
|
- name: Create Sentry release
|
|
|
|
uses: getsentry/action-release@v1
|
|
|
|
env:
|
|
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }}
|
|
|
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
|
|
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT_API}}
|
|
|
|
with:
|
|
|
|
environment: production
|
|
|
|
set_commits: skip
|
2021-07-19 18:35:21 +00:00
|
|
|
version: ${{ github.sha }}
|
|
|
|
|
|
|
|
- uses: codecov/codecov-action@v2
|
|
|
|
with:
|
2021-11-08 17:08:06 +00:00
|
|
|
flags: api
|
|
|
|
|
|
|
|
client-build:
|
|
|
|
name: Client
|
|
|
|
runs-on: ubuntu-latest
|
2022-09-03 13:37:44 +00:00
|
|
|
container: node:18-bullseye
|
2021-11-08 17:08:06 +00:00
|
|
|
timeout-minutes: 15
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./client
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Installling dependencies
|
2021-11-08 18:19:38 +00:00
|
|
|
run: npm install
|
2021-11-08 17:08:06 +00:00
|
|
|
|
|
|
|
- name: Lint
|
2021-11-08 18:19:38 +00:00
|
|
|
run: npm run lint
|
2021-11-08 17:08:06 +00:00
|
|
|
|
|
|
|
- name: Build
|
2021-11-08 18:19:38 +00:00
|
|
|
run: npm run build
|
2021-11-08 17:08:06 +00:00
|
|
|
env:
|
|
|
|
VITE_SENTRY_DSN: https://examplePublicKey@o0.ingest.sentry.io/0
|
|
|
|
VITE_NODE_ENV: development
|
2022-09-10 13:05:46 +00:00
|
|
|
VITE_API_ENDPOINT: https://jokesbapak2.reinaldyrafli.com/api/v1
|
2021-11-08 17:08:06 +00:00
|
|
|
|
|
|
|
- name: Initialize CodeQL
|
|
|
|
uses: github/codeql-action/init@v1
|
|
|
|
with:
|
|
|
|
languages: javascript
|
|
|
|
|
|
|
|
- name: Perform CodeQL Analysis
|
|
|
|
uses: github/codeql-action/analyze@v1
|
|
|
|
|
|
|
|
- name: Create Sentry release
|
|
|
|
uses: getsentry/action-release@v1
|
|
|
|
env:
|
|
|
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }}
|
|
|
|
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
|
|
|
|
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT_CLIENT }}
|
|
|
|
with:
|
|
|
|
environment: production
|
|
|
|
set_commits: skip
|
2022-09-03 13:37:44 +00:00
|
|
|
version: ${{ github.sha }}
|