Skip to content

Commit

Permalink
[TM-1271] Set up lint / test / build CI action
Browse files Browse the repository at this point in the history
  • Loading branch information
roguenet committed Sep 16, 2024
1 parent 172b4d3 commit 1897dab
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/ci.yml → .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,18 @@ jobs:
with:
fetch-depth: 0

- uses: KengoTODA/actions-setup-docker-compose@v1
with:
version: '2.29.1'

# This enables task distribution via Nx Cloud
# Run this command as early as possible, before dependencies are installed
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
- run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build"
# Note: this isn't currently working with this repo and distribution just isn't that necessary
# yet, with such a small codebase.
# - run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build"

- run: docker-compose up -d

# Cache node_modules
- uses: actions/setup-node@v4
Expand All @@ -29,7 +37,4 @@ jobs:
- run: npm ci --legacy-peer-deps
- uses: nrwl/nx-set-shas@v4

# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
# - run: npx nx-cloud record -- echo Hello World
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
- run: npx nx affected -t lint test build
- run: npx nx affected -t lint 'test --coverage --passWithNoTests' build
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ schema:
// test runs (the only time we let TypeORM modify the DB schema).
```

This codebase connects to the database running in the `wri-terramatch-api` docker container. The docker-compose
file included in this repo is used only for setting up the database needed for running unit tests in Github Actions.

15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"
services:
mariadb:
build:
context: "."
dockerfile: "docker/mariadb.Dockerfile"
ports:
- "3360:3306"
networks:
- "default"
environment:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "terramatch_microservices_test"
MYSQL_USER: "wri"
MYSQL_PASSWORD: "wri"
3 changes: 3 additions & 0 deletions docker/mariadb.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# MARIADB
FROM mariadb:10.3 AS mariadb
COPY docker/override.cnf /etc/mysql/mariadb.conf.d/override.cnf
10 changes: 10 additions & 0 deletions docker/override.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[client]
default-character-set=utf8mb4

[mysql]
default-character-set=utf8mb4

[mysqld]
collation-server = utf8mb4_unicode_520_ci
init-connect='SET NAMES utf8mb4'
character-set-server = utf8mb4

0 comments on commit 1897dab

Please sign in to comment.