diff --git a/.github/workflows/ci.yml b/.github/workflows/pull-request.yml similarity index 69% rename from .github/workflows/ci.yml rename to .github/workflows/pull-request.yml index a4d6a76..138853e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/pull-request.yml @@ -15,11 +15,17 @@ 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" + - run: docker-compose up -d + # Cache node_modules - uses: actions/setup-node@v4 with: @@ -29,7 +35,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 diff --git a/README.md b/README.md index fdce0d1..b682664 100644 --- a/README.md +++ b/README.md @@ -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. + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3f99ac5 --- /dev/null +++ b/docker-compose.yml @@ -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" diff --git a/docker/mariadb.Dockerfile b/docker/mariadb.Dockerfile new file mode 100644 index 0000000..0301945 --- /dev/null +++ b/docker/mariadb.Dockerfile @@ -0,0 +1,3 @@ +# MARIADB +FROM mariadb:10.3 AS mariadb +COPY docker/override.cnf /etc/mysql/mariadb.conf.d/override.cnf diff --git a/docker/override.cnf b/docker/override.cnf new file mode 100644 index 0000000..4b75bb5 --- /dev/null +++ b/docker/override.cnf @@ -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