Skip to content
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

build(repo): run tests in CI #22

Merged
merged 24 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4dea289
build(repo): run tests in CI
jwulf Feb 9, 2024
58b2954
ci(repo): rename local-integration test
jwulf Feb 9, 2024
e6928a4
ci(repo): correct docker-compose down file path
jwulf Feb 9, 2024
6ee8536
ci(repo): stop mono service in runner
jwulf Feb 9, 2024
0216fc4
ci(repo): check mono service status
jwulf Feb 12, 2024
37dc81c
ci(repo): move mono stop command later
jwulf Feb 12, 2024
2face4d
ci(repo): debug echo in CI
jwulf Feb 12, 2024
68eec52
ci(repo): killall monos
jwulf Feb 12, 2024
fdb599c
ci(repo): sudo kill mono
jwulf Feb 12, 2024
d2c42a6
ci(repo): fix nx arch-specific package installation
jwulf Feb 12, 2024
60f717d
ci: add dummy CAMUNDA_CLUSTER_ID
jwulf Feb 13, 2024
88be45e
ci(repo): add dummy CAMUNDA_CLUSTER_REGION
jwulf Feb 13, 2024
8362953
ci(repo): get tests to pass locally
jwulf Feb 14, 2024
35c7e64
ci(repo): debug token issue
jwulf Feb 14, 2024
ebaac50
ci: add trace logging of token
jwulf Feb 14, 2024
adf1cc9
ci(repo): stringify token in trace message
jwulf Feb 14, 2024
9acd410
ci(repo): trace log client id for token
jwulf Feb 14, 2024
bbb98e2
ci(repo): use 8.4.1 for local integration tests
jwulf Feb 14, 2024
f5e2589
docs(repo): add contribution instructions
jwulf Feb 15, 2024
91de271
docs(repo): add command to run local integration test
jwulf Feb 15, 2024
02bdcc7
build(oauth): run tests using src
jwulf Feb 21, 2024
b48baf2
build(oauth): move jest config to package.json
jwulf Feb 21, 2024
1758041
test(oauth): add jest transform to config
jwulf Feb 21, 2024
8d1979d
refactor(repo): flatten to a single package (#24)
jwulf Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
packages/*/dist/
dist/*
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"prettier",
"plugin:prettier/recommended"
],
"ignorePatterns": ["dist/"],
"rules": {
// Define your rules, for example:
"semi": "off",
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
with:
node-version: "18" # Specify a Node.js version

- name: Remove package-lock.json # This is to work around https://github.com/npm/cli/issues/4828
run: rm -f package-lock.json

- name: Install dependencies
run: npm install
env:
Expand All @@ -38,8 +41,8 @@ jobs:
git fetch
git checkout ${{ github.head_ref }}

# Add, commit, and push changes
git add -A
# Add, commit, and push changes, ignoring package-lock.json
git diff --name-only | grep -v 'package-lock.json' | xargs git add
git diff --staged --quiet || git commit -m "Apply Prettier formatting"
git push origin ${{ github.head_ref }}
env:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Integration Tests

on:
push:
branches:
- main

jobs:
integration:
runs-on: ubuntu-latest
environment: integration
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18" # Specify a Node.js version

# This is to force nx arch-specific packages to correctly install
# This is to work around https://github.com/npm/cli/issues/4828
- name: Remove package-lock.json
run: rm -f package-lock.json

- name: Install dependencies
run: npm install

- name: Run Integration Tests
run: |
lerna run test:integration
env:
ZEEBE_ADDRESS: ${{ secrets.ZEEBE_ADDRESS }}
ZEEBE_CLIENT_ID: ${{ secrets.ZEEBE_CLIENT_ID }}
ZEEBE_AUTHORIZATION_SERVER_URL: ${{ secrets.ZEEBE_AUTHORIZATION_SERVER_URL }}
ZEEBE_CLIENT_SECRET: ${{ secrets.ZEEBE_CLIENT_SECRET }}
ZEEBE_TOKEN_AUDIENCE: ${{ secrets.ZEEBE_TOKEN_AUDIENCE }}
CAMUNDA_CREDENTIALS_SCOPES: ${{ secrets.CAMUNDA_CREDENTIALS_SCOPES }}
CAMUNDA_OAUTH_URL: ${{ secrets.CAMUNDA_OAUTH_URL }}
CAMUNDA_TASKLIST_BASE_URL: ${{ secrets.CAMUNDA_TASKLIST_BASE_URL }}
CAMUNDA_OPERATE_BASE_URL: ${{ secrets.CAMUNDA_OPERATE_BASE_URL }}
CAMUNDA_OPTIMIZE_BASE_URL: ${{ secrets.CAMUNDA_OPTIMIZE_BASE_URL }}
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Run Local Integration Tests

on: [push, pull_request]

jobs:
local_integration:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18" # Specify a Node.js version

# This is to force nx arch-specific packages to correctly install
# This is to work around https://github.com/npm/cli/issues/4828
- name: Remove package-lock.json
run: rm -f package-lock.json

- name: Install dependencies
run: npm install

# Workaround for https://github.com/actions/runner-images/issues/2821
- name: Remove mono blocking 8084 port
run: sudo kill -9 $(sudo lsof -t -i:8084)

- name: Set up Docker Compose
run: |
docker-compose -f docker/docker-compose.yml up -d

- name: Run Integration Tests
run: |
lerna run test:local-integration
env:
ZEEBE_SECURE_CONNECTION: false
ZEEBE_ADDRESS: localhost:26500
ZEEBE_CLIENT_ID: zeebe
ZEEBE_AUTHORIZATION_SERVER_URL: http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token
ZEEBE_CLIENT_SECRET: zecret
ZEEBE_TOKEN_AUDIENCE: zeebe.camunda.io
CAMUNDA_CREDENTIALS_SCOPES: Zeebe,Tasklist,Operate,Optimize
CAMUNDA_OAUTH_URL: http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token
CAMUNDA_TASKLIST_BASE_URL: http://localhost:8082
CAMUNDA_OPERATE_BASE_URL: http://localhost:8081
CAMUNDA_OPTIMIZE_BASE_URL: http://localhost:8081
CAMUNDA_TEST_TYPE: local
DEBUG: camunda:token

- name: Cleanup
if: always()
run: docker-compose -f docker/docker-compose.yml down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ dist

.DS_Store

*.env
*.env
!docker/.env
File renamed without changes.
File renamed without changes.
74 changes: 74 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contributing to @camunda8/sdk

Thank you for considering contributing to @camunda8/sdk! We welcome contributions from the community to make our package even better.

## Getting Started

To get started with contributing, please follow these steps:

1. Fork the repository and clone it to your local machine.
2. Install the dependencies by running `npm install`.
3. Make your changes or additions to the codebase.
4. Write tests to cover your changes and ensure existing tests pass.
5. Run the tests using `npm test` to make sure everything is working correctly.
6. Commit your changes and push them to your forked repository.
7. Submit a pull request to the main repository.

## Running tests

Run all the unit tests with `lerna run test`.

### Integration tests

Integration tests can be run against Self-Managed or against Camunda SaaS.

To run integration tests against Camunda SaaS, but credentials for a Camunda SaaS API Client with scopes for all components in the environment, then run the integration tests against Camunda SaaS with `lerna run test:integration`.

To run the integration tests against Self-Managed, you can use either your own Self-Managed instance, or start one locally using Docker.

To start one locally, run `docker compose -f docker/docker-compose.yml up -d`.

Put the following credentials in the environment:

```bash
# Self-Managed
export ZEEBE_SECURE_CONNECTION=false
export ZEEBE_ADDRESS='localhost:26500'
export ZEEBE_CLIENT_ID='zeebe'
export ZEEBE_CLIENT_SECRET='zecret'
export ZEEBE_AUTHORIZATION_SERVER_URL='http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token'
export ZEEBE_TOKEN_AUDIENCE='zeebe.camunda.io'
export CAMUNDA_CREDENTIALS_SCOPES='Zeebe,Tasklist,Operate,Optimize'
export CAMUNDA_OAUTH_URL='http://localhost:18080/auth/realms/camunda-platform/protocol/openid-connect/token'
export CAMUNDA_TASKLIST_BASE_URL='http://localhost:8082'
export CAMUNDA_OPERATE_BASE_URL='http://localhost:8081'
export CAMUNDA_OPTIMIZE_BASE_URL='http://localhost:8083'
export CAMUNDA_TEST_TYPE='local'
```

Now run the integration tests against Self-Managed with `lerna run test:local-integration`.

## Code Style

We follow a specific code style in our project to maintain consistency. Please make sure to adhere to the following guidelines:

- Run `lerna run lint` to lint your code with ESLint.
- Run `lerna run prettify` to format your code to the project standard.

## Issue Reporting

If you encounter any bugs or issues while using @camunda/sdk, please report them in the [issue tracker](https://github.com/camunda-community-hub/camunda-8-js-sdk/issues). Provide as much detail as possible, including steps to reproduce the issue.

## Feature Requests

If you have any ideas or feature requests for @camunda/sdk, please submit them in the [issue tracker](https://github.com/camunda-community-hub/camunda-8-js-sdk/issues). We appreciate your feedback and suggestions.

## License

By contributing to @camunda/sdk, you agree that your contributions will be licensed under the [Apache License](https://opensource.org/licenses/Apache).

## Contact

If you have any questions or need further assistance, feel free to reach out to us at [your-email@example.com].

Happy contributing!
File renamed without changes.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Camunda 8 JavaScript SDK

This is the monorepo for the official Camunda 8 JavaScript SDK.

## Using the SDK in your project

Install the SDK as a dependency:

```bash
npm i @camunda/sdk
```
22 changes: 22 additions & 0 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Image versions ##
# CAMUNDA_CONNECTORS_VERSION=0.23.2
CAMUNDA_CONNECTORS_VERSION=8.4.1
CAMUNDA_OPTIMIZE_VERSION=8.4.1
CAMUNDA_PLATFORM_VERSION=8.4.1
CAMUNDA_WEB_MODELER_VERSION=8.4.1
ELASTIC_VERSION=8.9.0
KEYCLOAK_SERVER_VERSION=22.0.3
MAILPIT_VERSION=v1.7.0
POSTGRES_VERSION=14.5-alpine
HOST=localhost

## Configuration ##
# By default the zeebe api is public, when setting this to `identity` a valid zeebe client token is required
ZEEBE_AUTHENTICATION_MODE=identity
ZEEBE_CLIENT_ID=zeebe
ZEEBE_CLIENT_SECRET=zecret

# Set to 'true' to enable resource based authorizations for users and groups
# This can be used to limit access for users or groups to view/update specific
# processes and decisions in Operate and Tasklist
RESOURCE_AUTHORIZATIONS_ENABLED=false
2 changes: 2 additions & 0 deletions docker/connector-secrets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# add secrets per line in the format NAME=VALUE
# WARNING: ensure not to commit changes to this file
Loading
Loading