-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #258 from DataDog/tonycthsu/github-test
[SDTEST-1266] Add Github Actions tests
- Loading branch information
Showing
12 changed files
with
482 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,18 +22,13 @@ test_containers: | |
description: Resource class to use | ||
type: string | ||
default: medium | ||
edge: | ||
description: Use latest version of dependencies during testing | ||
type: boolean | ||
default: false | ||
resource_class: <<parameters.resource_class_to_use>> | ||
- &container_base_environment | ||
BUNDLE_GEMFILE: /app/Gemfile | ||
# Faster JVM startup: https://github.com/jruby/jruby/wiki/Improving-startup-time#use-the---dev-flag | ||
JRUBY_OPTS: --dev | ||
- &container_parameters_environment | ||
- *container_base_environment | ||
- COVERAGE_BASE_DIR: coverage | ||
- &container_base | ||
image: <<parameters.image>> | ||
environment: *container_parameters_environment | ||
|
@@ -76,14 +71,6 @@ step_bundle_install: &step_bundle_install | |
else | ||
echo "All required gems were found in cache." | ||
fi | ||
step_lint: &step_lint | ||
run: | ||
name: Lint 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 standardrb | ||
step_appraisal_install: &step_appraisal_install | ||
run: | ||
name: Install Appraisal gems | ||
|
@@ -137,8 +124,6 @@ filters_only_release_tags: &filters_only_release_tags | |
|
||
orbs: | ||
orb: | ||
orbs: | ||
codecov: codecov/[email protected] | ||
jobs: | ||
build: | ||
<<: *test_job_default | ||
|
@@ -156,17 +141,6 @@ orbs: | |
- bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum ".circleci/images/primary/binary_version" }}-<<parameters.ruby_version>>-{{ checksum "lib/datadog/ci/version.rb" }} | ||
- *check_exact_bundle_cache_hit | ||
- *step_bundle_install | ||
- when: | ||
condition: | ||
equal: [<< parameters.edge >>, true] | ||
steps: | ||
- *step_appraisal_update # Run on latest version of all gems we integrate with | ||
- when: | ||
condition: | ||
not: | ||
equal: [<< parameters.edge >>, true] | ||
steps: | ||
- *step_appraisal_install # Run on a stable set of gems we integrate with | ||
- *save_bundle_checksum | ||
- save_cache: | ||
key: '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<<parameters.ruby_version>>-{{ .Environment.CIRCLE_SHA1 }}' | ||
|
@@ -188,50 +162,9 @@ orbs: | |
- restore_cache: | ||
keys: | ||
- bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum ".circleci/images/primary/binary_version" }}-<<parameters.ruby_version>>-{{ checksum "lib/datadog/ci/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }} | ||
- run: | ||
name: Set coverage report directory | ||
command: | | ||
# Create a unique coverage directory for this job, to avoid conflicts when merging all results | ||
echo 'export COVERAGE_DIR="$COVERAGE_BASE_DIR/versions/$CIRCLE_JOB/$CIRCLE_NODE_INDEX"' >> $BASH_ENV | ||
- *step_run_all_tests | ||
- store_test_results: | ||
path: /tmp/rspec | ||
- persist_to_workspace: | ||
root: . | ||
paths: | ||
- coverage | ||
lint: | ||
<<: *test_job_default | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<<parameters.ruby_version>>-{{ .Environment.CIRCLE_SHA1 }}' | ||
- restore_cache: | ||
keys: | ||
- bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum ".circleci/images/primary/binary_version" }}-<<parameters.ruby_version>>-{{ checksum "lib/datadog/ci/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }} | ||
- *step_lint | ||
coverage: | ||
<<: *test_job_default | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- '{{ .Environment.CIRCLE_CACHE_VERSION }}-bundled-repo-<<parameters.ruby_version>>-{{ .Environment.CIRCLE_SHA1 }}' | ||
- restore_cache: | ||
keys: | ||
- bundle-{{ .Environment.CIRCLE_CACHE_VERSION }}-{{ checksum ".circleci/images/primary/binary_version" }}-<<parameters.ruby_version>>-{{ checksum "lib/datadog/ci/version.rb" }}-{{ .Branch }}-{{ checksum ".circleci/bundle_checksum" }} | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- run: | ||
name: Generate combined coverage report for all tests | ||
command: COVERAGE_DIR=/tmp/workspace/coverage bundle exec rake coverage:report | ||
- codecov/upload: | ||
file: /tmp/workspace/coverage/report/coverage.xml | ||
- run: | ||
name: Generate individual coverage report for each Ruby version | ||
command: COVERAGE_DIR=/tmp/workspace/coverage bundle exec rake coverage:report_per_ruby_version | ||
- store_artifacts: | ||
path: /tmp/workspace/coverage/report/ | ||
destination: coverage | ||
commands: | ||
docker-wait: | ||
description: Wait for containers to listen on a TCP port. | ||
|
@@ -297,95 +230,10 @@ job_configuration: | |
workflows: | ||
version: 2 | ||
build-and-test: | ||
jobs: | ||
- orb/lint: | ||
<<: *config-3_3-small | ||
name: lint | ||
requires: | ||
- build-3.2 | ||
- orb/coverage: | ||
<<: *config-3_3-small | ||
name: coverage | ||
requires: | ||
- test-2.7 | ||
- test-3.0 | ||
- test-3.1 | ||
- test-3.2 | ||
- test-3.3 | ||
- test-3.4 | ||
# ADD NEW RUBIES HERE | ||
- test-jruby-9.4 | ||
- orb/build: | ||
<<: *config-2_7 | ||
name: build-2.7 | ||
- orb/test: | ||
<<: *config-2_7 | ||
name: test-2.7 | ||
requires: | ||
- build-2.7 | ||
- orb/build: | ||
<<: *config-3_0 | ||
name: build-3.0 | ||
- orb/test: | ||
<<: *config-3_0 | ||
name: test-3.0 | ||
requires: | ||
- build-3.0 | ||
- orb/build: | ||
<<: *config-3_1 | ||
name: build-3.1 | ||
- orb/test: | ||
<<: *config-3_1 | ||
name: test-3.1 | ||
requires: | ||
- build-3.1 | ||
- orb/build: | ||
<<: *config-3_2 | ||
name: build-3.2 | ||
- orb/test: | ||
<<: *config-3_2 | ||
name: test-3.2 | ||
requires: | ||
- build-3.2 | ||
- orb/build: | ||
<<: *config-3_3 | ||
name: build-3.3 | ||
- orb/test: | ||
<<: *config-3_3 | ||
name: test-3.3 | ||
requires: | ||
- build-3.3 | ||
- orb/build: | ||
<<: *config-3_4 | ||
name: build-3.4 | ||
- orb/test: | ||
<<: *config-3_4 | ||
name: test-3.4 | ||
requires: | ||
- build-3.4 | ||
# ADD NEW RUBIES HERE | ||
- orb/build: | ||
<<: *config-jruby-9_4 | ||
name: build-jruby-9.4 | ||
- orb/test: | ||
<<: *config-jruby-9_4 | ||
name: test-jruby-9.4 | ||
requires: | ||
- build-jruby-9.4 | ||
# This workflow runs the same `build` and `test` jobs as above on a schedule. | ||
edge: | ||
triggers: | ||
- schedule: | ||
cron: '0 0 * * 1-5' # Every weekday | ||
filters: | ||
branches: | ||
only: | ||
- main | ||
jobs: | ||
- orb/build: | ||
<<: *config-2_7 | ||
name: build-2.7 | ||
edge: true | ||
- orb/test: | ||
<<: *config-2_7 | ||
name: test-2.7 | ||
|
@@ -394,7 +242,6 @@ workflows: | |
- orb/build: | ||
<<: *config-3_0 | ||
name: build-3.0 | ||
edge: true | ||
- orb/test: | ||
<<: *config-3_0 | ||
name: test-3.0 | ||
|
@@ -403,7 +250,6 @@ workflows: | |
- orb/build: | ||
<<: *config-3_1 | ||
name: build-3.1 | ||
edge: true | ||
- orb/test: | ||
<<: *config-3_1 | ||
name: test-3.1 | ||
|
@@ -412,7 +258,6 @@ workflows: | |
- orb/build: | ||
<<: *config-3_2 | ||
name: build-3.2 | ||
edge: true | ||
- orb/test: | ||
<<: *config-3_2 | ||
name: test-3.2 | ||
|
@@ -421,7 +266,6 @@ workflows: | |
- orb/build: | ||
<<: *config-3_3 | ||
name: build-3.3 | ||
edge: true | ||
- orb/test: | ||
<<: *config-3_3 | ||
name: test-3.3 | ||
|
@@ -430,7 +274,6 @@ workflows: | |
- orb/build: | ||
<<: *config-3_4 | ||
name: build-3.4 | ||
edge: true | ||
- orb/test: | ||
<<: *config-3_4 | ||
name: test-3.4 | ||
|
@@ -440,7 +283,6 @@ workflows: | |
- orb/build: | ||
<<: *config-jruby-9_4 | ||
name: build-jruby-9.4 | ||
edge: true | ||
- orb/test: | ||
<<: *config-jruby-9_4 | ||
name: test-jruby-9.4 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.