diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml new file mode 100644 index 00000000..54e57c92 --- /dev/null +++ b/.github/workflows/integration-test.yml @@ -0,0 +1,219 @@ +name: Integration tests + +on: + workflow_dispatch: + push: + branches: + - alpha + +jobs: + unit-tests: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" # Specify a Node.js version + + - name: Install dependencies + run: npm install + + - name: Build and Smoke Test + run: npm run test:smoketest + + - name: Run Unit Tests + run: | + npm run test + + # unit-tests-windows: + # runs-on: windows-2019 + # steps: + # - name: Check out the repo + # uses: actions/checkout@v4 + + # - name: Use Node.js + # uses: actions/setup-node@v4 + # with: + # node-version: "20" # Specify a Node.js version + + # - name: Install dependencies + # run: npm install + + # - name: Build + # run: npm run build + + # - name: Run Unit Tests + # run: | + # npm run test + + local_integration: + runs-on: ubuntu-latest + environment: + name: selfhosted + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" # Specify a Node.js version + + - 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 + run: | + echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username joshua.wulf --password-stdin registry.camunda.cloud + + - name: Set up Docker Compose + run: | + docker-compose -f docker/docker-compose.yaml -f docker/docker-compose-modeler.yaml up -d + + - name: Run Integration Tests + run: | + npm run test:local-integration + env: + CAMUNDA_SECURE_CONNECTION: false + ZEEBE_ADDRESS: localhost:26500 + ZEEBE_CLIENT_ID: zeebe + ZEEBE_CLIENT_SECRET: zecret + 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:8083 + CAMUNDA_MODELER_BASE_URL: http://localhost:8070/api + + - name: Cleanup + if: always() + run: docker-compose -f docker/docker-compose.yaml -f docker/docker-compose-modeler.yaml down + + local_multitenancy_integration: + runs-on: ubuntu-latest + environment: + name: selfhosted + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" # Specify a Node.js version + + - 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 + run: | + echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username joshua.wulf --password-stdin registry.camunda.cloud + + - name: Set up Docker Compose + run: | + docker-compose -f docker/docker-compose-multitenancy.yaml -f docker/docker-compose-modeler.yaml up -d + + - name: Run Integration Tests + run: | + npm run test:multitenancy + env: + CAMUNDA_SECURE_CONNECTION: false + ZEEBE_ADDRESS: localhost:26500 + ZEEBE_CLIENT_ID: zeebe + ZEEBE_CLIENT_SECRET: zecret + 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:8083 + CAMUNDA_MODELER_BASE_URL: http://localhost:8070/api + # Needed for Multi-Tenancy + CAMUNDA_TENANT_ID: + + - name: Cleanup + if: always() + run: docker-compose -f docker/docker-compose-multitenancy.yaml -f docker/docker-compose-modeler.yaml down + + saas_integration: + runs-on: ubuntu-latest + environment: integration + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" # Specify a Node.js version + + - name: Install dependencies + run: npm install + + - name: Run Integration Tests + run: | + npm run test:integration + env: + ZEEBE_ADDRESS: ${{ secrets.ZEEBE_ADDRESS }} + ZEEBE_REST_ADDRESS: ${{ secrets.ZEEBE_REST_ADDRESS }} + ZEEBE_GRPC_ADDRESS: ${{ secrets.ZEEBE_GRPC_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 }} + CAMUNDA_MODELER_BASE_URL: https://modeler.cloud.camunda.io/api + CAMUNDA_CONSOLE_CLIENT_ID: ${{ secrets.CAMUNDA_CONSOLE_CLIENT_ID }} + CAMUNDA_CONSOLE_CLIENT_SECRET: ${{ secrets.CAMUNDA_CONSOLE_CLIENT_SECRET }} + CAMUNDA_CONSOLE_BASE_URL: ${{ secrets.CAMUNDA_CONSOLE_BASE_URL }} + CAMUNDA_CONSOLE_OAUTH_AUDIENCE: ${{ secrets.CAMUNDA_CONSOLE_OAUTH_AUDIENCE}} + + # saas_integration_windows: + # needs: saas_integration + # runs-on: windows-2019 + # environment: integration + # steps: + # - name: Check out the repo + # uses: actions/checkout@v4 + + # - name: Use Node.js + # uses: actions/setup-node@v4 + # with: + # node-version: "20" # Specify a Node.js version + + # - name: Install dependencies + # run: npm install + + # - name: Run Integration Tests + # run: | + # npm run test:integration + # env: + # ZEEBE_ADDRESS: ${{ secrets.ZEEBE_ADDRESS }} + # ZEEBE_REST_ADDRESS: ${{ secrets.ZEEBE_REST_ADDRESS }} + # ZEEBE_GRPC_ADDRESS: ${{ secrets.ZEEBE_GRPC_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 }} + # CAMUNDA_MODELER_BASE_URL: https://modeler.cloud.camunda.io/api + # CAMUNDA_CONSOLE_CLIENT_ID: ${{ secrets.CAMUNDA_CONSOLE_CLIENT_ID }} + # CAMUNDA_CONSOLE_CLIENT_SECRET: ${{ secrets.CAMUNDA_CONSOLE_CLIENT_SECRET }} + # CAMUNDA_CONSOLE_BASE_URL: ${{ secrets.CAMUNDA_CONSOLE_BASE_URL }} + # CAMUNDA_CONSOLE_OAUTH_AUDIENCE: ${{ secrets.CAMUNDA_CONSOLE_OAUTH_AUDIENCE}} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ffd07876..b2e7fbe4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,7 +5,6 @@ on: push: branches: - main - - alpha jobs: unit-tests: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f0fb27d9..3334a948 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,6 +6,8 @@ Thank you for considering contributing to @camunda8/sdk! We welcome contribution To get started with contributing, please follow these steps: +It's a good idea to discuss your contribution in an issue in the repository first, to align on the approach - particularly if it is a new feature. + 1. Fork the repository and clone it to your local machine. 2. Check out the `alpha` branch. This is the development branch. 3. Install the dependencies by running `npm install`. @@ -13,13 +15,14 @@ To get started with contributing, please follow these steps: 5. Write tests to cover your changes and ensure existing tests pass. 6. Run the tests using `npm test` to make sure everything is working correctly. See below for details on running integration tests. 7. Commit your changes and push them to your forked repository. Use [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) format for the commit message. See the note below. -8. Submit a pull request to the main repository. -9. When your PR is merged into the `alpha` branch, an alpha package is published to NPM. -10. When the `alpha` branch is merged into `main`, a new package is published to NPM. +8. Submit a pull request against `alpha`. +9. If any changes are needed they will be requested. +10. Your PR will be merged to `alpha` and the integration tests run in CI. +11. When the `alpha` branch is merged into `main`, a new package is published to NPM. ## A note on commit messages -The repository uses []`semantic-release`](https://github.com/semantic-release/semantic-release) to create releases. Because we track the Camunda 8 Platform minor version, we treat feature implementation during a minor release cycle as a patch release rather than a minor release. +The repository uses [`semantic-release`](https://github.com/semantic-release/semantic-release) to create releases. Because we track the Camunda 8 Platform minor version, we treat feature implementation during a minor release cycle as a patch release rather than a minor release. Creating a commit with a `feat` commit message will cause the package version patch release number to increment. To update the minor version, a commit with the type `minor` is needed. diff --git a/release.config.js b/release.config.js index d9d830ed..64869b2c 100644 --- a/release.config.js +++ b/release.config.js @@ -1,12 +1,6 @@ // eslint-disable-next-line no-undef module.exports = { - branches: [ - 'main', - { - name: 'alpha', - prerelease: true, - }, - ], + branches: ['main'], repositoryUrl: 'https://github.com/camunda/camunda-8-js-sdk.git', plugins: [ [ diff --git a/src/optimize/lib/OptimizeApiClient.ts b/src/optimize/lib/OptimizeApiClient.ts index 6d0d8e4f..c1cb01fc 100644 --- a/src/optimize/lib/OptimizeApiClient.ts +++ b/src/optimize/lib/OptimizeApiClient.ts @@ -95,7 +95,7 @@ export class OptimizeApiClient { } private async getHeaders(auth = true) { - const token = await this.oAuthProvider.getToken('OPERATE') + const token = await this.oAuthProvider.getToken('OPTIMIZE') const authHeader: { authorization: string } | Record = auth ? {