Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Circleci monorepo setup #25

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2.1

# this allows you to use CircleCI's dynamic configuration feature
setup: true

# the path-filtering orb is required to continue a pipeline based on
# the path of an updated fileset
orbs:
path-filtering: circleci/[email protected]

workflows:
# the always-run workflow is always triggered, regardless of the pipeline parameters.
always-run:
jobs:
- path-filtering/filter:
name: check-updated-files

# Test which path is updated and set the parameter for continue_config
mapping: |
apps/backend/.* backend-changed true
apps/web/.* web-changed true
apps/mobile/.* mobile-changed true
# Compare changes of the branch with main branch
base-revision: main

# this is the path of the configuration we should trigger once
# path filtering and pipeline parameter value updates are
# complete. In this case, we are using the parent dynamic
# configuration itself.

config-path: .circleci/continue_config.yml
85 changes: 85 additions & 0 deletions .circleci/continue_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
version: 2.1

commands:
setup:
steps:
- run:
command: |
corepack enable --install-directory ~/bin
yarn install

# the default pipeline parameters, which will be updated according to
# the results of the path-filtering orb
parameters:
backend-changed:
type: boolean
default: false
web-changed:
type: boolean
default: false
mobile-changed:
type: boolean
default: false

workflows:
run-backend-tests:
when: << pipeline.parameters.backend-changed >>
jobs:
- backend-tests
run-web-tests:
when: << pipeline.parameters.web-changed >>
jobs:
- web-tests
run-mobile-tests:
when: << pipeline.parameters.mobile-changed >>
jobs:
- mobile-tests

jobs:
backend-tests:
docker:
- image: cimg/node:20.17
- image: cimg/postgres:13.4-postgis
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: hylo
POSTGRES_DB: hylo_test
- image: redis
environment:
NODE_ENV: test
DATABASE_URL: postgres://localhost:5432/hylo_test
DOMAIN: testdomain
# this prevents jobs that were queued during testing from being run in development
KUE_NAMESPACE: qtest
PROTOCOL: http
# don't log errors to Rollbar
ROLLBAR_SERVER_TOKEN: 0
steps:
- checkout
- setup
- run:
command: |
cd apps/backend
yarn test

web-tests:
docker:
- image: cimg/node:20.17
steps:
- checkout
- setup
- run:
command: |
cd apps/web
yarn test

mobile-tests:
docker:
- image: cimg/node:20.17
steps:
- checkout
- setup
- run:
command: |
cd apps/mobile
yarn test