Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 49 additions & 7 deletions .github/workflows/pr-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,49 @@ jobs:
name: Mabl Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: pnpm/action-setup@9fd676a19091d4595eefd76e4bd31c97133911f1 # v4.2.0
- uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'

cache: 'pnpm'

- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Run checks
run: npm run check
run: pnpm run check

- name: Run Tests
run: npm test
run: pnpm test

- name: Compile Typescript
run: npm run build
run: pnpm run build

- name: Run mabl tests (no-wait)
id: mabl-test-no-wait
uses: ./
env:
MABL_API_KEY: ${{ secrets.MABL_API_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
application-id: D6uz-lhAGBYuTTc6Jj_w0Q-a
environment-id: I9tfo2dWd7WSigXcO91feA-e
app-url: 'https://storage.googleapis.com/public-test-pages/uptime/canary.html'
await-completion: false
plan-labels: |
canary

- name: Validate no-wait outputs
run: |
if [ -z "${{ steps.mabl-test-no-wait.outputs.mabl-deployment-id }}" ]; then
echo "::error::mabl-deployment-id should be set when await-completion=false"
exit 1
fi
if [ -n "${{ steps.mabl-test-no-wait.outputs.plans_run }}" ]; then
echo "::error::plans_run should NOT be set when await-completion=false"
exit 1
fi

- name: Run mabl tests against deployment
id: mabl-test-deployment
Expand All @@ -43,3 +70,18 @@ jobs:
http-headers: |
X-Test-Header-1: 1234
X-Test-Header-2: 5678

- name: Validate wait outputs
run: |
if [ -z "${{ steps.mabl-test-deployment.outputs.mabl-deployment-id }}" ]; then
echo "::error::mabl-deployment-id should be set when await-completion=true"
exit 1
fi
if [ -z "${{ steps.mabl-test-deployment.outputs.plans_run }}" ]; then
echo "::error::plans_run should be set when await-completion=true"
exit 1
fi
if [ -z "${{ steps.mabl-test-deployment.outputs.tests_run }}" ]; then
echo "::error::tests_run should be set when await-completion=true"
exit 1
fi
17 changes: 9 additions & 8 deletions .github/workflows/push-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,24 @@ jobs:
name: Mabl Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v6
- uses: pnpm/action-setup@9fd676a19091d4595eefd76e4bd31c97133911f1 # v4.2.0
- uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'

cache: 'pnpm'

- name: Install dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Run checks
run: npm run check
run: pnpm run check

- name: Run Tests
run: npm test
run: pnpm test

- name: Compile Typescript
run: npm run build
run: pnpm run build

- name: Run mabl tests against deployment
id: mabl-test-deployment
Expand All @@ -44,4 +46,3 @@ jobs:
http-headers: |
X-Test-Header-1: 1234
X-Test-Header-2: 5678

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ typings/
*.swp

#compiled js
lib/*.js
lib/*
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
24
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Releases can then be built from that branch by running

```bash
# Compile release
npm run release
pnpm run release

# Commit the built release files
git commit -m "<version, e.g. v1.4> release"
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ jobs:

**Note**: Either `application-id` or `environment-id` must be supplied.

- `await-completion` {boolean} (optional) - Set to `false` to trigger tests
without waiting for results. Only the `mabl-deployment-id` output will be set.
Defaults to `true`.
- `application-id` {string} (optional) - mabl id for the deployed application.
Use the
[curl builder](https://app.mabl.com/workspaces/-/settings/apis#api-docs-selector-dropdown-button)
Expand Down Expand Up @@ -141,6 +144,10 @@ jobs:
- `tests_failed` {int32} - number of mabl tests that failed against this
deployment.

**Note**: Metric outputs (`plans_run`, `plans_passed`, `plans_failed`,
`tests_run`, `tests_passed`, `tests_failed`) are only available when
`await-completion` is `true` (the default).


## Contributing

Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ branding:
icon: play-circle
color: white
inputs:
await-completion:
description: 'Set to false to trigger tests without waiting for results. Only the mabl-deployment-id output will be set.'
required: false
default: 'true'
application-id:
description: ^
'Mabl id for the deployed application. You can get the id using the
Expand Down Expand Up @@ -86,5 +90,5 @@ outputs:
description: "Number of mabl tests that failed against this deployment."

runs:
using: "node20"
using: "node24"
main: "lib/src/entrypoint.js"
16 changes: 16 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
roots: ['<rootDir>/test'],
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
useESM: true,
},
],
},
extensionsToTreatAsEsm: ['.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
testEnvironment: 'node',
};
7 changes: 0 additions & 7 deletions jest.config.js

This file was deleted.

Loading
Loading