From d2b474f61419899c93b323e7493738fdfb51bef5 Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Tue, 5 Nov 2024 16:48:51 +0100 Subject: [PATCH] Migrate Lint job from CircleCI to Github Action --- .circleci/config.yml | 32 -------------------------------- .github/workflows/check.yml | 25 ++++++++++++++++--------- 2 files changed, 16 insertions(+), 41 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7efeec46ea3..64cd0f32c8f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -151,22 +151,6 @@ step_bundle_install: &step_bundle_install else echo "All required gems were found in cache." fi -step_rubocop: &step_rubocop - run: - name: Delint with Rubocop - # There's no straightforward way to get the number of available processors & CPU threads in CircleCI. - # Currently it always return 18 physical processors and 36 threads, regardless of executor size. - # The workaround is to use `cpu.shares / 1024`: - # https://discuss.circleci.com/t/environment-variable-set-to-the-number-of-available-cpus/32670/4 - command: PARALLEL_PROCESSOR_COUNT=$((`cat /sys/fs/cgroup/cpu/cpu.shares` / 1024)) bundle exec rake rubocop -step_standardrb: &step_standardrb - run: - name: Delint with Standardrb - # There's no straightforward way to get the number of available processors & CPU threads in CircleCI. - # Currently it always return 18 physical processors and 36 threads, regardless of executor size. - # The workaround is to use `cpu.shares / 1024`: - # https://discuss.circleci.com/t/environment-variable-set-to-the-number-of-available-cpus/32670/4 - command: PARALLEL_PROCESSOR_COUNT=$((`cat /sys/fs/cgroup/cpu/cpu.shares` / 1024)) bundle exec rake standard step_appraisal_install: &step_appraisal_install run: name: Install Appraisal gems @@ -375,17 +359,6 @@ orbs: root: . paths: - coverage - lint: - <<: *test_job_default - steps: - - restore_cache: - keys: - - '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<>-{{ .Environment.CIRCLE_SHA1 }}' - - restore_cache: - keys: - - bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum ".circleci/images/primary/binary_version" }}-<>-{{ checksum "lib/datadog/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }} - - *step_rubocop - - *step_standardrb coverage: <<: *test_job_default steps: @@ -513,11 +486,6 @@ workflows: version: 2 build-and-test: jobs: - - orb/lint: - <<: *config-2_7-small - name: lint - requires: - - build-2.7 - orb/coverage: <<: *config-2_7-small name: coverage diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e8f10f9cfe9..d3d290b41fe 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,20 +1,27 @@ name: Check on: push: - branches: [ '**' ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ '**' ] + jobs: + lint: + runs-on: ubuntu-latest + container: + image: ghcr.io/datadog/images-rb/engines/ruby:3.2 + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: bundle install + - run: bundle exec rake rubocop standard + check: name: Check types - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest + container: + image: ghcr.io/datadog/images-rb/engines/ruby:3.2 steps: - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.2' - bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Install dependencies + run: bundle install - name: Check for stale signature files run: bundle exec rake rbs:stale - name: Check for missing signature files