-
Notifications
You must be signed in to change notification settings - Fork 538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added github workflow for unit tests #328
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
22cc2b5
added github workflow for unit tests
3af73b7
test coverage only on node12
15795bb
fix for coverage
a754b6c
uncommented real tests
e0a474b
removed circleci
83e010f
run codecov on all versions
82653d5
Merge branch 'main' into gh-actions
willarmiros cd02960
Merge remote-tracking branch 'upstream/main' into main
98329bd
resolved conflicts
541a590
only run coverage on node14
8d88183
Merge branch 'main' into gh-actions
willarmiros 3573330
Merge branch 'main' into gh-actions
willarmiros File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,132 @@ | ||
name: Unit Tests | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
unit-test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
container: ["node:8", "node:10", "node:12", "node:14"] | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ${{ matrix.container }} | ||
services: | ||
mongo: | ||
image: mongo | ||
ports: | ||
- 27017:27017 | ||
postgres: | ||
image: circleci/postgres:9.6-alpine | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: circle_database | ||
ports: | ||
- 5432:5432 | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
redis: | ||
image: redis | ||
ports: | ||
- 6379:6379 | ||
options: >- | ||
--health-cmd "redis-cli ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
mysql: | ||
image: circleci/mysql:5.7 | ||
env: | ||
MYSQL_USER: otel | ||
MYSQL_PASSWORD: secret | ||
MYSQL_DATABASE: circle_database | ||
MYSQL_ROOT_PASSWORD: rootpw | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd="mysqladmin ping" | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
env: | ||
RUN_POSTGRES_TESTS: 1 | ||
RUN_MYSQL_TESTS: 1 | ||
RUN_MONGODB_TESTS: 1 | ||
RUN_REDIS_TESTS: 1 | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: circle_database | ||
POSTGRES_HOST: postgres | ||
POSTGRES_PORT: 5432 | ||
OPENTELEMETRY_REDIS_HOST: redis | ||
OPENTELEMETRY_REDIS_PORT: 6379 | ||
MONGODB_DB: opentelemetry-tests | ||
MONGODB_HOST: mongo | ||
MONGODB_PORT: 27017 | ||
MYSQL_USER: otel | ||
MYSQL_PASSWORD: secret | ||
MYSQL_DATABASE: circle_database | ||
MYSQL_HOST: mysql | ||
MYSQL_PORT: 3306 | ||
NPM_CONFIG_UNSAFE_PERM: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Cache Dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
node_modules | ||
package-lock.json | ||
detectors/node/*/node_modules | ||
metapackages/*/node_modules | ||
packages/*/node_modules | ||
plugins/node/*/node_modules | ||
plugins/web/*/node_modules | ||
propagators/*/node_modules | ||
key: ${{ runner.os }}-${{ matrix.container }}-${{ hashFiles('**/package.json') }} | ||
- name: Install Root Dependencies | ||
run: npm install --ignore-scripts | ||
- name: Boostrap Dependencies | ||
run: npx lerna bootstrap --no-ci | ||
- name: Unit tests | ||
run: npm run test | ||
- name: Report Coverage | ||
if: matrix.container == 'node:14' | ||
run: npm run codecov | ||
browser-tests: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: circleci/node:12-browsers | ||
env: | ||
NPM_CONFIG_UNSAFE_PERM: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v1 | ||
- name: Permission Setup | ||
run: sudo chmod -R 777 /github /__w | ||
- name: Cache Dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
node_modules | ||
package-lock.json | ||
detectors/node/*/node_modules | ||
metapackages/*/node_modules | ||
packages/*/node_modules | ||
plugins/node/*/node_modules | ||
plugins/web/*/node_modules | ||
propagators/*/node_modules | ||
key: ${{ runner.os }}-node:12-${{ hashFiles('**/package.json') }} | ||
- name: Install Root Dependencies | ||
run: npm install --ignore-scripts | ||
- name: Boostrap Dependencies | ||
run: npx lerna bootstrap --no-ci | ||
- name: Unit tests | ||
run: npm run test:browser | ||
- name: Report Coverage | ||
run: npm run codecov:browser |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this will report coverage for each version of node, not just 14
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah I removed the conditional here to see if it would fix the codecov diff, I'll add it back in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to approve with the assumption you will fix this before it gets merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be good now :) thanks for the catch