-
Notifications
You must be signed in to change notification settings - Fork 1
110 lines (105 loc) · 2.89 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: CI
on:
push:
branches:
- main
jobs:
skip-draft:
name: skip draft
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: fail on draft
if: github.event.pull_request.draft == true
run: echo "is a draft PR, failing..." && exit 1
- name: success
run: echo "is not a draft PR"
lint:
needs: skip-draft
name: Lint
runs-on: ubuntu-latest
container: node:lts
timeout-minutes: 10
steps:
- name: Check out repository code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Typecheck
run: yarn typecheck
- name: Eslint
run: yarn lint:ci
- name: Prettier
run: yarn format:ci
tests:
needs: skip-draft
name: Test
runs-on: ubuntu-latest
container: node:lts
timeout-minutes: 10
services:
database:
image: mongo:6.0.15-jammy
env:
MONGO_INITDB_ROOT_USERNAME: acid
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: develop
options: >-
--health-cmd "echo 'dgit stb.runCommand("ping").ok' | mongosh --quiet"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 27017:27017
aws:
image: localstack/localstack
env:
SERVICES: sqs
AWS_DEFAULT_REGION: eu-west-1
ports:
- '4566:4566'
strategy:
matrix:
shard: [1]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Tests
run: |
yarn test:ci --shard=${{ matrix.shard }}/${{ strategy.job-total }}
env:
DB_HOST: database
DB_USERNAME: acid
DB_PASSWORD: password
DB_DATABASE: develop
AWS_ENDPOINT: http://aws:4566
AWS_SQS_URL: http://sqs.eu-west-1.aws.localstack.cloud:4566/000000000000/localstack-queue
docker-build:
needs: skip-draft
name: Build Docker Container
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push docker image
uses: docker/[email protected]
with:
context: .
file: ./docker/Dockerfile
push: false
tags: nestjs:latest