From 8b2c1063640c3cc49d211f3af9e144d6695f488d Mon Sep 17 00:00:00 2001 From: Jurre Stender Date: Thu, 1 Apr 2021 16:18:16 +0200 Subject: [PATCH 1/3] CI: Simplify workflow by moving suite specific tests into test script We were setting up a bunch of conditional tests/linting in the workflow file, but now that we have test scripts I think it's cleaner to run those inline in the `script/ci-test` script --- .github/workflows/ci.yml | 19 ------------------- bundler/script/ci-test | 12 ++++++++++++ npm_and_yarn/script/ci-test | 3 +++ python/script/ci-test | 1 + 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 923639c194d..b5b8d3bf278 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,25 +98,6 @@ jobs: run: | docker push "$CORE_CI_IMAGE:latest" docker push "$CORE_CI_IMAGE:ci--$BRANCH_REF" - - name: Run Python flake8 linting - if: matrix.suite.name == 'python' - run: | - docker run --rm "$CORE_CI_IMAGE" bash -c "pyenv exec flake8 python/helpers/. --count --exclude=./.*,./python/spec/fixtures --show-source --statistics" - - name: Run js linting and tests - if: matrix.suite.name == 'npm_and_yarn' - run: | - docker run --rm "$CORE_CI_IMAGE" bash -c "cd /opt/npm_and_yarn && npm run lint" - docker run --rm "$CORE_CI_IMAGE" bash -c "cd /opt/npm_and_yarn && npm test" - - name: Run bundler v1 native helper specs - if: matrix.suite.name == 'bundler1' - run: | - docker run --rm "$CORE_CI_IMAGE" bash -c \ - "cd /home/dependabot/dependabot-core/bundler/helpers/v1 && BUNDLER_VERSION=1 bundle install && BUNDLER_VERSION=1 bundle exec rspec spec" - - name: Run bundler v2 native helper specs - if: matrix.suite.name == 'bundler2' - run: | - docker run --rm "$CORE_CI_IMAGE" bash -c \ - "cd /home/dependabot/dependabot-core/bundler/helpers/v2 && BUNDLER_VERSION=2 bundle install && BUNDLER_VERSION=2 bundle exec rspec spec" - name: Run ${{ matrix.suite.name }} tests run: | docker run --env "CI=true" --env "DEPENDABOT_TEST_ACCESS_TOKEN=$DEPENDABOT_TEST_ACCESS_TOKEN" --env "SUITE_NAME=${{ matrix.suite.name }}" --rm "$CORE_CI_IMAGE" bash -c \ diff --git a/bundler/script/ci-test b/bundler/script/ci-test index 64621ed5616..f4998489b95 100755 --- a/bundler/script/ci-test +++ b/bundler/script/ci-test @@ -3,3 +3,15 @@ bundle install bundle exec rubocop . bundle exec rspec spec + +[ "$SUITE_NAME" == "bundler1" ] &&\ + cd /home/dependabot/dependabot-core/bundler/helpers/v1 && \ + BUNDLER_VERSION=1 bundle install && \ + BUNDLER_VERSION=1 bundle exec rspec spec &&\ + cd - + +[ "$SUITE_NAME" == "bundler2" ] &&\ + cd /home/dependabot/dependabot-core/bundler/helpers/v2 && \ + BUNDLER_VERSION=2 bundle install && \ + BUNDLER_VERSION=2 bundle exec rspec spec &&\ + cd - diff --git a/npm_and_yarn/script/ci-test b/npm_and_yarn/script/ci-test index 64621ed5616..ce799a6fecd 100755 --- a/npm_and_yarn/script/ci-test +++ b/npm_and_yarn/script/ci-test @@ -3,3 +3,6 @@ bundle install bundle exec rubocop . bundle exec rspec spec + +cd /opt/npm_and_yarn && npm run lint && cd - +cd /opt/npm_and_yarn && npm test && cd - diff --git a/python/script/ci-test b/python/script/ci-test index 64621ed5616..1ef2818e075 100755 --- a/python/script/ci-test +++ b/python/script/ci-test @@ -1,5 +1,6 @@ #!/bin/sh bundle install +pyenv exec flake8 helpers/. --count --exclude=./.*,./python/spec/fixtures --show-source --statistics bundle exec rubocop . bundle exec rspec spec From 475d265a6fa8fcdba331a24fe1fe973a04c04fff Mon Sep 17 00:00:00 2001 From: Jurre Date: Thu, 1 Apr 2021 17:16:19 +0200 Subject: [PATCH 2/3] Apply suggestions from code review Co-authored-by: Philip Harrison --- bundler/script/ci-test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bundler/script/ci-test b/bundler/script/ci-test index f4998489b95..2953d7bab9e 100755 --- a/bundler/script/ci-test +++ b/bundler/script/ci-test @@ -5,13 +5,13 @@ bundle exec rubocop . bundle exec rspec spec [ "$SUITE_NAME" == "bundler1" ] &&\ - cd /home/dependabot/dependabot-core/bundler/helpers/v1 && \ + cd helpers/v1 && \ BUNDLER_VERSION=1 bundle install && \ BUNDLER_VERSION=1 bundle exec rspec spec &&\ cd - [ "$SUITE_NAME" == "bundler2" ] &&\ - cd /home/dependabot/dependabot-core/bundler/helpers/v2 && \ + cd helpers/v2 && \ BUNDLER_VERSION=2 bundle install && \ BUNDLER_VERSION=2 bundle exec rspec spec &&\ cd - From 7c84fdbdfda7be64df1e9d7737d095edbf4d84b1 Mon Sep 17 00:00:00 2001 From: Jurre Stender Date: Thu, 1 Apr 2021 18:32:03 +0200 Subject: [PATCH 3/3] Fix conditional native helper tests --- bundler/script/ci-test | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bundler/script/ci-test b/bundler/script/ci-test index 2953d7bab9e..d85ac473df5 100755 --- a/bundler/script/ci-test +++ b/bundler/script/ci-test @@ -4,14 +4,16 @@ bundle install bundle exec rubocop . bundle exec rspec spec -[ "$SUITE_NAME" == "bundler1" ] &&\ +if [ "$SUITE_NAME" == "bundler1" ]; then cd helpers/v1 && \ BUNDLER_VERSION=1 bundle install && \ BUNDLER_VERSION=1 bundle exec rspec spec &&\ cd - +fi -[ "$SUITE_NAME" == "bundler2" ] &&\ +if [ "$SUITE_NAME" == "bundler2" ]; then cd helpers/v2 && \ BUNDLER_VERSION=2 bundle install && \ BUNDLER_VERSION=2 bundle exec rspec spec &&\ cd - +fi