diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index e547844..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,120 +0,0 @@ -version: 2 - -# build job parameters as a template -defaults: &defaults - working_directory: ~/repo - docker: - # the Docker image with Cypress dependencies - - image: cimg/node:20.5.1 - auth: - username: $DOCKERHUB_USER - password: $DOCKERHUB_PASSWORD - environment: - ## this enables colors in the output - TERM: xterm - -default_cache_keys: &default_cache_keys - keys: - - v1-yarn-deps-{{ checksum "yarn.lock" }} - - v1-yarn-deps - -default_save_cache: &default_save_cache - key: v1-yarn-deps-{{ checksum "yarn.lock" }} - paths: - - node_modules - -install_yarn: &install_yarn - name: Install yarn - command: yarn policies set-version 1.x - -jobs: - install_packages: - # Main build process - <<: *defaults - steps: - # Checkout repo - - checkout - - run: *install_yarn - # Restore yarn cache - - restore_cache: *default_cache_keys - # Install & Build - - run: yarn install - # Save updated yarn cache - - save_cache: *default_save_cache - - build: - <<: *defaults - steps: - # Checkout repo - - checkout - - run: *install_yarn - # Restore yarn cache - - restore_cache: *default_cache_keys - # Create a build - - run: - name: Creating a build - command: yarn run build - # Save public repo to a shared workspace - # This way can be used in future tests - - persist_to_workspace: - root: ~/repo/dist - paths: - - ./* - - unitTests: - # Unit tests (jest) - <<: *defaults - parallelism: 3 - steps: - # Checkout git repo - - checkout - - run: *install_yarn - # Restore yarn cache - - restore_cache: *default_cache_keys - # Run the jest tests - - run: - name: Run tests - command: | - yarn test --ci --runInBand - environment: - JEST_JUNIT_OUTPUT_DIR: 'reports/junit/js-test-results.xml' - - store_test_results: - name: Store test results - path: ./reports/junit - - linting: - # Linting (eslint/prettier) - <<: *defaults - steps: - # Checkout git repo - - checkout - - run: *install_yarn - # Restore yarn cache - - restore_cache: *default_cache_keys - # Run eslint - - run: - name: Running lint processes - command: yarn lint - -workflows: - version: 2 - build_and_test: - jobs: - - install_packages: - context: - - hubblehq-docker - - build: - context: - - hubblehq-docker - requires: - - install_packages - - unitTests: - context: - - hubblehq-docker - requires: - - install_packages - - linting: - context: - - hubblehq-docker - requires: - - install_packages diff --git a/.npmignore b/.npmignore index 8ce2e1b..8283fcd 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,4 @@ -/.circleci +/cloudbuild.yaml /.jest /build-scripts /coverage diff --git a/cloudbuild.yaml b/cloudbuild.yaml new file mode 100644 index 0000000..bfaf5e9 --- /dev/null +++ b/cloudbuild.yaml @@ -0,0 +1,56 @@ +steps: + - id: 'Create .env file' + name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:alpine' + args: + - sh + - -c + - | + echo "SENTRY_DSN=''" > .env + - id: 'Build image' + name: 'gcr.io/cloud-builders/docker' + entrypoint: 'sh' + args: + - -c + - | + docker build \ + --target dev \ + -t europe-west1-docker.pkg.dev/${PROJECT_ID}/hubblehq-docker/request \ + . + - id: 'Run linting' + name: 'gcr.io/cloud-builders/docker' + entrypoint: 'sh' + args: + - -c + - | + docker compose \ + -f docker-compose.yml \ + --profile dev \ + run \ + --rm \ + dev yarn lint + waitFor: ['Build image'] + + - id: 'Run tests' + name: 'gcr.io/cloud-builders/docker' + entrypoint: 'sh' + args: + - -c + - | + docker compose \ + -f docker-compose.yml \ + --profile dev \ + run \ + --rm \ + dev yarn test + waitFor: ['Build image', 'Run linting'] + +substitutions: + _SERVICE_NAME: request + _BUILD_ID_SHORT: ${BUILD_ID:0:8} + _DOCKER_TAG: ${LOCATION}-docker.pkg.dev/${PROJECT_ID}/hubblehq-docker/${_SERVICE_NAME} + _DOCKER_TAG_SCRIPTS: ${LOCATION}-docker.pkg.dev/${PROJECT_ID}/hubblehq-docker/${_SERVICE_NAME}-scripts + +options: + dynamicSubstitutions: true + machineType: 'E2_HIGHCPU_8' + logging: CLOUD_LOGGING_ONLY \ No newline at end of file