Skip to content

chore: implement devcontainers #825

chore: implement devcontainers

chore: implement devcontainers #825

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
types: [synchronize, opened, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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@v4
- uses: actions/cache@v4
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@v4
- uses: actions/cache@v4
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
QUEUE_HOST: queue
QUEUE_USERNAME: acid
QUEUE_PASSWORD: password
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@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push docker image
uses: docker/build-push-action@v5
with:
push: false
tags: nestjs:latest