diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index c178ecddf2..f1ed6eb87e 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -114,9 +114,9 @@ jobs: - name: Test run: | if ${{ env.ONLY_AFFECTED_TASKS }}; then - yarn test --ignore=@budibase/worker --ignore=@budibase/server --since=${{ env.NX_BASE_BRANCH }} + yarn test -- --ignore=@budibase/worker --ignore=@budibase/server --no-prefix --since=${{ env.NX_BASE_BRANCH }} -- --verbose --reporters=default --reporters=github-actions else - yarn test --ignore=@budibase/worker --ignore=@budibase/server + yarn test -- --ignore=@budibase/worker --ignore=@budibase/server --no-prefix -- --verbose --reporters=default --reporters=github-actions fi test-worker: @@ -138,16 +138,22 @@ jobs: - name: Test worker run: | if ${{ env.ONLY_AFFECTED_TASKS }}; then - node scripts/run-affected.js --task=test --scope=@budibase/worker --since=${{ env.NX_BASE_BRANCH }} - else - yarn test --scope=@budibase/worker + AFFECTED=$(yarn --silent nx show projects --affected -t test --base=${{ env.NX_BASE_BRANCH }} -p @budibase/worker) + if [ -z "$AFFECTED" ]; then + echo "No affected tests to run" + exit 0 + fi fi + cd packages/worker + yarn test --verbose --reporters=default --reporters=github-actions + test-server: runs-on: ubuntu-latest strategy: matrix: - datasource: [mssql, mysql, postgres, mongodb, mariadb, oracle, none] + datasource: + [mssql, mysql, postgres, mongodb, mariadb, oracle, sqs, none] steps: - name: Checkout repo uses: actions/checkout@v4 @@ -210,7 +216,7 @@ jobs: fi cd packages/server - yarn test --filter $FILTER --passWithNoTests + yarn test --filter $FILTER --verbose --reporters=default --reporters=github-actions check-pro-submodule: runs-on: ubuntu-latest diff --git a/package.json b/package.json index 07e0010bf2..af39a4048d 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "dev:server": "yarn run kill-server && lerna run --stream dev --scope @budibase/worker --scope @budibase/server", "dev:built": "yarn run kill-all && cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream dev:built", "dev:docker": "./scripts/devDocker.sh", - "test": "lerna run --concurrency 1 --stream test --stream", + "test": "lerna run --concurrency 1 --stream test", "test:containers:kill": "./scripts/killTestcontainers.sh", "lint:eslint": "eslint packages --max-warnings=0", "lint:prettier": "prettier --check \"packages/**/*.{js,ts,svelte}\" && prettier --write \"examples/**/*.{js,ts,svelte}\"", diff --git a/scripts/run-affected.js b/scripts/run-affected.js deleted file mode 100755 index 97f79bb463..0000000000 --- a/scripts/run-affected.js +++ /dev/null @@ -1,34 +0,0 @@ -/*** - * Running lerna with since and scope is not working as expected. - * For example, running the command `yarn test --scope=@budibase/worker --since=master`, with changes only on `@budibase/backend-core` will not work as expected, as it does not analyse the dependencies properly. The actual `@budibase/worker` task will not be triggered. - * - * This script is using `lerna ls` to detect all the affected projects from a given commit, and if the scoped package is affected, the actual command will be executed. - * - * The current version of the script only supports a single project in the scope. - */ - -const { execSync } = require("child_process") - -const argv = require("yargs").demandOption(["task", "since", "scope"]).argv - -const { task, since, scope } = argv - -const affectedPackages = execSync( - `yarn --silent nx show projects --affected -t ${task} --base=${since} --json`, - { - encoding: "utf-8", - } -) - -const packages = JSON.parse(affectedPackages) - -const isAffected = packages.includes(scope) - -if (isAffected) { - console.log(`${scope} is affected. Running task "${task}"`) - execSync(`yarn ${task} --scope=${scope}`, { - stdio: "inherit", - }) -} else { - console.log(`${scope} is not affected. Skipping task "${task}"`) -}