diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 245749aa4..63a69424c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,30 +102,8 @@ jobs: uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 with: commit_message: Update THIRD_PARTY_LICENSES.txt - test: - strategy: - matrix: - test-suits: - - name: UI - include: ui-*,*-ui - - name: Blocks Shard 1 - include: blocks-a*,blocks-c*,blocks-d*, - - name: Blocks Shard 2 - include: blocks-f*,blocks-g*,blocks-m*, - - name: Blocks Shard 3 - include: blocks-* - exclude: blocks-a*,blocks-c*,blocks-d*,blocks-f*,blocks-g*,blocks-m*, - - name: Server API Unit Tests - key: server-api-unit - target: test-unit - include: server-api - - name: Server API Integration Tests - key: server-api-integration - include: server-api - - name: Engine and Libraries - key: others - exclude: ui-*,*-ui,blocks-*,server-api - name: Test ${{ matrix.test-suits.name }} + build: + name: Build Project needs: install runs-on: ubuntu-latest steps: @@ -141,25 +119,46 @@ jobs: uses: actions/cache@v5.0.1 with: path: .nx/cache - key: nx-test-${{ matrix.test-suits.key || matrix.test-suits.name }}-${{ github.sha }} - restore-keys: nx-test-${{ matrix.test-suits.key || matrix.test-suits.name }}- - save-always: true - - name: Test - if: steps.nx-test-cache.outputs.cache-hit != 'true' - continue-on-error: false - uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 - with: - timeout_minutes: 10 - max_attempts: 3 - retry_on: error - command: npx nx run-many --target ${{ matrix.test-suits.target || 'test' }} --projects "${{ matrix.test-suits.include }}" --exclude "${{ matrix.test-suits.exclude }}" --quiet + key: nx-build-${{ github.sha }} + restore-keys: nx-build- + - name: Build project env: NX_REJECT_UNKNOWN_LOCAL_CACHE: 0 - - name: Truncate NX cache - run: ./tools/truncate-nx-cache.sh - build: - name: Build Project - needs: install + run: | + npm run prepare + npx nx run-many --target=build + ./tools/truncate-nx-cache.sh + - name: Save build cache + uses: actions/cache/save@v5.0.1 + with: + path: dist + key: dist-${{ github.sha }} + test: + strategy: + matrix: + test-suits: + - name: UI + include: ui-*,*-ui + - name: Blocks Shard 1 + include: blocks-a*,blocks-c*,blocks-d*, + - name: Blocks Shard 2 + include: blocks-f*,blocks-g*,blocks-m*, + - name: Blocks Shard 3 + include: blocks-* + exclude: blocks-a*,blocks-c*,blocks-d*,blocks-f*,blocks-g*,blocks-m*, + - name: Server API Unit Tests + key: server-api-unit + target: test-unit + include: server-api + - name: Server API Integration Tests + key: server-api-integration + target: test-integration + include: server-api + - name: Engine and Libraries + key: others + exclude: ui-*,*-ui,blocks-*,server-api + name: Test ${{ matrix.test-suits.name }} + needs: [ install, build ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v6.0.1 @@ -170,24 +169,32 @@ jobs: path: node_modules key: node-modules-cache-${{ hashFiles('package-lock.json', '.npmrc') }} fail-on-cache-miss: true + - name: Restore build cache + uses: actions/cache/restore@v5.0.1 + with: + path: dist + key: dist-${{ github.sha }} + fail-on-cache-miss: true - name: Restore NX cache uses: actions/cache@v5.0.1 with: path: .nx/cache - key: nx-build-${{ github.sha }} - restore-keys: nx-build- - - name: Build project + key: nx-test-${{ matrix.test-suits.key || matrix.test-suits.name }}-${{ github.sha }} + restore-keys: nx-test-${{ matrix.test-suits.key || matrix.test-suits.name }}- + save-always: true + - name: Test + if: steps.nx-test-cache.outputs.cache-hit != 'true' + continue-on-error: false + uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 + with: + timeout_minutes: 10 + max_attempts: 3 + retry_on: error + command: npx nx run-many --target ${{ matrix.test-suits.target || 'test' }} --projects "${{ matrix.test-suits.include }}" --exclude "${{ matrix.test-suits.exclude }}" --quiet env: NX_REJECT_UNKNOWN_LOCAL_CACHE: 0 - run: | - npm run prepare - npx nx run-many --target=build - ./tools/truncate-nx-cache.sh - - name: Save build cache - uses: actions/cache/save@v5.0.1 - with: - path: dist - key: dist-${{ github.sha }} + - name: Truncate NX cache + run: ./tools/truncate-nx-cache.sh build-images: strategy: matrix: diff --git a/packages/server/api/project.json b/packages/server/api/project.json index 99d6f997c..dcf3a7768 100644 --- a/packages/server/api/project.json +++ b/packages/server/api/project.json @@ -93,11 +93,10 @@ "testPathPattern": ["packages/server/api/test/integration/cloud"] } }, - "test": { + "test-integration": { "executor": "nx:run-commands", "options": { "commands": [ - "nx run-many -t build -p server*,blocks-*,openops*,shared", "./tools/link-packages.sh", "export $(cat packages/server/api/.env.tests | xargs) && OPS_EDITION=cloud nx test-cloud server-api --output-style stream-without-prefixes", "export $(cat packages/server/api/.env.tests | xargs) && OPS_EDITION=ce nx test-ce server-api --output-style stream-without-prefixes" @@ -105,6 +104,17 @@ "parallel": false } }, + "test": { + "executor": "nx:run-commands", + "options": { + "commands": [ + "nx run-many -t build -p server*,blocks-*,openops*,shared", + "nx test-unit server-api", + "nx test-integration server-api" + ], + "parallel": false + } + }, "test:docker": { "command": "UID=\"$(id -u)\" GID=\"$(id -g)\" docker compose --profile full -f docker-compose.test.yml up --exit-code-from app --attach app" },