diff --git a/.github/workflows/changed-files.yaml b/.github/workflows/changed-files.yaml new file mode 100644 index 0000000000000..91fddaf1da0f1 --- /dev/null +++ b/.github/workflows/changed-files.yaml @@ -0,0 +1,27 @@ +name: Changed files reusable workflow +on: + workflow_call: + inputs: + files: + required: true + type: string + outputs: + any_changed: + value: ${{ jobs.changed-files.outputs.any_changed }} + +jobs: + changed-files: + timeout-minutes: 5 + runs-on: depot-ubuntu-24.04-8 + outputs: + any_changed: ${{ steps.changed-files.outputs.any_changed }} + steps: + - name: Fetch custom Github Actions and base branch history + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Check for changed files + id: changed-files + uses: tj-actions/changed-files@v45 + with: + files: ${{ inputs.files }} diff --git a/.github/workflows/ci-final-check.yaml b/.github/workflows/ci-final-check.yaml new file mode 100644 index 0000000000000..7e3775de242c9 --- /dev/null +++ b/.github/workflows/ci-final-check.yaml @@ -0,0 +1,15 @@ +name: CI final check reusable workflow +on: + workflow_call: + +jobs: + ci-server-final: + if: always() && !cancelled() + timeout-minutes: 1 + runs-on: depot-ubuntu-24.04-8 + steps: + - run: echo ${{ needs.prerequisites.result }} + - run: echo "${{ toJson(needs.*.result) }}" + - name: Fail job if any needs failed ${{ needs }} + if: contains(needs.*.result, 'failure') + run: exit 1 diff --git a/.github/workflows/ci-server.yaml b/.github/workflows/ci-server.yaml index 452627fe0077f..fea8e91383ddd 100644 --- a/.github/workflows/ci-server.yaml +++ b/.github/workflows/ci-server.yaml @@ -5,7 +5,7 @@ on: - main pull_request: - + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -15,24 +15,13 @@ env: jobs: prerequisites: - timeout-minutes: 5 - runs-on: depot-ubuntu-24.04-8 - outputs: - any_changed: ${{ steps.changed-files.outputs.any_changed }} - steps: - - name: Fetch custom Github Actions and base branch history - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Check for changed files - id: changed-files - uses: tj-actions/changed-files@v45 - with: - files: | - package.json - packages/twenty-server/** - packages/twenty-emails/** - packages/twenty-shared/** + uses: ./.github/workflows/changed-files.yaml + with: + files: | + package.json + packages/twenty-server/** + packages/twenty-emails/** + packages/twenty-shared/** server-setup: needs: prerequisites if: needs.prerequisites.outputs.any_changed == 'true' @@ -46,8 +35,8 @@ jobs: env: PGUSER_SUPERUSER: postgres PGPASSWORD_SUPERUSER: postgres - ALLOW_NOSSL: "true" - SPILO_PROVIDER: "local" + ALLOW_NOSSL: 'true' + SPILO_PROVIDER: 'local' ports: - 5432:5432 options: >- @@ -130,7 +119,7 @@ jobs: uses: ./.github/workflows/actions/restore-cache with: key: ${{ env.SERVER_SETUP_CACHE_KEY }} - - name: Server / Run Tests + - name: Server / Run Tests uses: ./.github/workflows/actions/nx-affected with: tag: scope:backend @@ -146,8 +135,8 @@ jobs: env: PGUSER_SUPERUSER: postgres PGPASSWORD_SUPERUSER: postgres - ALLOW_NOSSL: "true" - SPILO_PROVIDER: "local" + ALLOW_NOSSL: 'true' + SPILO_PROVIDER: 'local' ports: - 5432:5432 options: >- @@ -182,7 +171,7 @@ jobs: uses: ./.github/workflows/actions/nx-affected with: tag: scope:backend - tasks: "test:integration:with-db-reset" + tasks: 'test:integration:with-db-reset' - name: Server / Upload reset-logs file if: always() uses: actions/upload-artifact@v4 @@ -190,11 +179,5 @@ jobs: name: reset-logs path: reset-logs.log ci-server-final: - if: always() && !cancelled() - timeout-minutes: 1 - runs-on: depot-ubuntu-24.04-8 needs: [prerequisites, server-setup, server-test, server-integration-test] - steps: - - name: Fail job if any needs failed - if: contains(needs.*.result, 'failure') - run: exit 1 \ No newline at end of file + uses: ./.github/workflows/ci-final-check.yaml \ No newline at end of file