From dc2438f998fcdc29baad0da2f7b1d5a7cc638a64 Mon Sep 17 00:00:00 2001 From: Jake Naviasky Date: Tue, 8 Jun 2021 13:10:03 -0400 Subject: [PATCH] Integrate github actions. (#1219) * Migrate CI to github actions. * Add NO_CLIENT env for test suite. * Map postgres port to localhost. --- .circleci/config.yml | 37 ----------------------- .github/workflows/build.yml | 59 +++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 37 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/build.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 784e33b6250..00000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,37 +0,0 @@ -# Javascript Node CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-javascript/ for more details -# -version: 2 -jobs: - build: - docker: - # Service container image - - image: circleci/node:14.7.0 - - image: circleci/postgres:9.6.2-alpine - environment: - POSTGRES_USER: commonwealth - POSTGRES_DB: commonwealth - - working_directory: ~/commonwealth - - steps: - # inital checkout - - checkout - - restore_cache: - key: dependency-cache-{{ checksum "yarn.lock" }} - - run: - name: update dependencies - command: yarn - - save_cache: - key: dependency-cache-{{ checksum "yarn.lock" }} - paths: - - ./node_modules - - run: - name: "set env var for no client" - command: echo 'export NO_CLIENT="true"' >> $BASH_ENV - - run: - name: run tests - command: yarn test-suite - - store_artifacts: - path: coverage diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..5c4f799032b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,59 @@ +name: Build +on: [push] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + services: + postgres: + image: postgres + env: + POSTGRES_USER: commonwealth + POSTGRES_DB: commonwealth + POSTGRES_PASSWORD: edgeware + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + + steps: + - name: Checkout + uses: actions/checkout@v1 + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 14.x + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install dependencies + run: yarn + + - name: Run tests + run: yarn test-suite + env: + NO_CLIENT: true + + - name: Archive code coverage results + uses: actions/upload-artifact@v2 + with: + name: code-coverage-report + path: coverage