From 759bac7bd964e14b79dbebf804ddeea5febdc760 Mon Sep 17 00:00:00 2001 From: Jeremy Green Date: Mon, 23 Oct 2023 11:45:07 -0500 Subject: [PATCH] pull in changes from the starter repo --- .github/workflows/_database_schema_check.yml | 19 +++++++++- .github/workflows/_reusable_workflows.yml | 2 +- .../_run_super_scaffolding_tests.yml | 33 ++++------------- .github/workflows/_run_tests.yml | 37 +++++-------------- .../workflows/ci-cd-pipeline-bt-internal.yml | 20 ++++++++++ .github/workflows/ci-cd-pipeline-main.yml | 11 ------ .github/workflows/ci-cd-pipeline.yml | 4 -- 7 files changed, 56 insertions(+), 70 deletions(-) create mode 100644 .github/workflows/ci-cd-pipeline-bt-internal.yml diff --git a/.github/workflows/_database_schema_check.yml b/.github/workflows/_database_schema_check.yml index 3cc7abc6..a2298e09 100644 --- a/.github/workflows/_database_schema_check.yml +++ b/.github/workflows/_database_schema_check.yml @@ -9,8 +9,24 @@ on: jobs: check: runs-on: ubuntu-latest + services: + postgres: + image: postgres:11-alpine + ports: + - "5432:5432" + env: + POSTGRES_DB: rails_test + POSTGRES_USER: rails + POSTGRES_PASSWORD: password + # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 env: RAILS_ENV: test + DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test" BUNDLE_JOBS: 2 BUNDLE_RETRY: 3 steps: @@ -24,4 +40,5 @@ jobs: - name: Database Schema Check id: db-schema-check - run : bash ./.circleci/db_schema_check + run : ./.circleci/db_schema_check + continue-on-error: false diff --git a/.github/workflows/_reusable_workflows.yml b/.github/workflows/_reusable_workflows.yml index f1b11824..5b773ebb 100644 --- a/.github/workflows/_reusable_workflows.yml +++ b/.github/workflows/_reusable_workflows.yml @@ -1,6 +1,6 @@ # This is a dummy workflow that's just here to add a bit of organization to the workflow list. # Too bad they don't allow you to hide workflows or something. -name: " ๐Ÿšซ |----- Reusable Worflows Below" +name: " ๐Ÿšซ |----- Reusable Worfklows Below" on: workflow_call: diff --git a/.github/workflows/_run_super_scaffolding_tests.yml b/.github/workflows/_run_super_scaffolding_tests.yml index d1fc472a..d699f246 100644 --- a/.github/workflows/_run_super_scaffolding_tests.yml +++ b/.github/workflows/_run_super_scaffolding_tests.yml @@ -8,17 +8,13 @@ on: jobs: test: + name: "๐Ÿ—๏ธ" runs-on: ubuntu-latest strategy: fail-fast: false matrix: - # Set N number of parallel jobs you want to run tests on. - # Use higher number if you have slow tests to split them on more parallel jobs. - # Remember to update ci_node_index below to 0..N-1 - ci_node_total: [7] - # set N-1 indexes for parallel jobs - # When you run 2 parallel jobs then first job will have index 0, the second job will have index 1 etc - ci_node_index: [0, 1, 2, 3, 4, 5, 6] + # For super scaffolding tests we need to have exactly 7 runners. + ci_runners: [TestSite, Project, 'Project::Step', Insight, 'Personality::Disposition', 'Personality::Observation', TestFile] services: postgres: image: postgres:11-alpine @@ -58,25 +54,10 @@ jobs: with: bundler-cache: true - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Cache yarn cache directory - uses: actions/cache@v3 + - uses: actions/setup-node@v3 with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Cache node_modules - uses: actions/cache@v3 - with: - path: node_modules - key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node-modules- + node-version-file: .nvmrc + cache: 'yarn' - name: asset cache uses: actions/cache@v3 @@ -107,7 +88,7 @@ jobs: - name: 'Setup Super Scaffolding System Test' run: bundle exec test/bin/setup-super-scaffolding-system-test env: - CIRCLE_NODE_INDEX: ${{ matrix.ci_node_index }} + CIRCLE_NODE_INDEX: ${{ strategy.job-index }} - name: 'Run Super Scaffolding Test' run: bundle exec rails test test/system/super_scaffolding_test.rb diff --git a/.github/workflows/_run_tests.yml b/.github/workflows/_run_tests.yml index cae68936..388c43fa 100644 --- a/.github/workflows/_run_tests.yml +++ b/.github/workflows/_run_tests.yml @@ -8,17 +8,15 @@ on: jobs: test: + name: "๐Ÿงช" runs-on: ubuntu-latest strategy: fail-fast: false matrix: - # Set N number of parallel jobs you want to run tests on. - # Use higher number if you have slow tests to split them on more parallel jobs. - # Remember to update ci_node_index below to 0..N-1 - ci_node_total: [7] - # set N-1 indexes for parallel jobs - # When you run 2 parallel jobs then first job will have index 0, the second job will have index 1 etc - ci_node_index: [0, 1, 2, 3, 4, 5, 6] + # Set identifiers for parallel jobs. These can be anything. Just include as many items as you want parallelism. + # For instance if you want a Three Amigos themed pipeline you could use: + # ci_node_index: [Dusty, Ned, Lucky] + ci_runners: [1,2,3,4] services: postgres: image: postgres:11-alpine @@ -58,25 +56,10 @@ jobs: with: bundler-cache: true - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - name: Cache yarn cache directory - uses: actions/cache@v3 + - uses: actions/setup-node@v3 with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Cache node_modules - uses: actions/cache@v3 - with: - path: node_modules - key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node-modules- + node-version-file: .nvmrc + cache: 'yarn' - name: asset cache uses: actions/cache@v3 @@ -102,8 +85,8 @@ jobs: env: AUTH_ENDPOINT: https://no-site.nowhere AWS_REGION: us-east-1 - CI_NODE_TOTAL: ${{ matrix.ci_node_total }} - CI_NODE_INDEX: ${{ matrix.ci_node_index }} + CI_NODE_TOTAL: ${{ strategy.job-total }} + CI_NODE_INDEX: ${{ strategy.job-index }} continue-on-error: false run : ./bin/parallel-ci shell: bash diff --git a/.github/workflows/ci-cd-pipeline-bt-internal.yml b/.github/workflows/ci-cd-pipeline-bt-internal.yml new file mode 100644 index 00000000..15919628 --- /dev/null +++ b/.github/workflows/ci-cd-pipeline-bt-internal.yml @@ -0,0 +1,20 @@ +# This workflow will run whenever a PR is opened or changed. +# +# It will run tests and a few safety checks. +# +# If everything passes it can be set to auto-deploy to your staging app on Heroku. +# +# This workflow is primarily meant to be triggered automatically, but it can be run manually. +name: " ๐Ÿš… _ BT - Internal CI Pipeline" +on: + workflow_dispatch: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: [ "main" ] + +jobs: + super_scaffolding: + name: ๐Ÿ—๏ธ Super Scaffolding Tests + uses: ./.github/workflows/_run_super_scaffolding_tests.yml + secrets: inherit diff --git a/.github/workflows/ci-cd-pipeline-main.yml b/.github/workflows/ci-cd-pipeline-main.yml index b03b7e2c..75672167 100644 --- a/.github/workflows/ci-cd-pipeline-main.yml +++ b/.github/workflows/ci-cd-pipeline-main.yml @@ -16,10 +16,6 @@ jobs: name: ๐Ÿงช MiniTest uses: ./.github/workflows/_run_tests.yml secrets: inherit - super_scaffolding: - name: ๐Ÿ—๏ธ Super Scaffolding Tests - uses: ./.github/workflows/_run_super_scaffolding_tests.yml - secrets: inherit standardrb: name: ๐Ÿ”ฌ Standardrb uses: ./.github/workflows/_standardrb.yml @@ -38,10 +34,3 @@ jobs: # secrets: inherit # with: # heroku-app-name: "" - deploy: - name: ๐Ÿšข Deploy to Heroku - uses: ./.github/workflows/_deploy_heroku.yml - needs: [mini_test, super_scaffolding, standardrb, db_schema] - secrets: inherit - with: - heroku-app-name: "bullettrain-co" diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index 9d46da2a..bed07635 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -16,10 +16,6 @@ jobs: name: ๐Ÿงช MiniTest uses: ./.github/workflows/_run_tests.yml secrets: inherit - super_scaffolding: - name: ๐Ÿ—๏ธ Super Scaffolding Tests - uses: ./.github/workflows/_run_super_scaffolding_tests.yml - secrets: inherit standardrb: name: ๐Ÿ”ฌ Standardrb uses: ./.github/workflows/_standardrb.yml