From c9239e278d5a5e4e6a69d659f340104f7e2b9488 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 23 Oct 2024 16:58:09 -0500 Subject: [PATCH] chore: remove old integration test --- .github/workflows/e2e-test2.yml | 155 ------------------------ .github/workflows/integration-test.yml | 118 +++++++++--------- .github/workflows/integration-test2.yml | 119 ------------------ 3 files changed, 56 insertions(+), 336 deletions(-) delete mode 100644 .github/workflows/e2e-test2.yml delete mode 100644 .github/workflows/integration-test2.yml diff --git a/.github/workflows/e2e-test2.yml b/.github/workflows/e2e-test2.yml deleted file mode 100644 index ff0ebfbd63..0000000000 --- a/.github/workflows/e2e-test2.yml +++ /dev/null @@ -1,155 +0,0 @@ -name: "E2e test" - -on: - pull_request: - branches: [main] - -jobs: - build: - name: clustered buck2 builds - runs-on: ubuntu-latest - timeout-minutes: 15 - strategy: - matrix: - cluster: - - name: core-apis - targets: "//:node_modules //core/api //core/api-ws-server //core/api-trigger //core/api-exporter" - - fail-fast: false - - steps: - - id: vars - run: echo "short_sha=${GITHUB_SHA:0:7}" >> $GITHUB_ENV - - - name: Maximize build space - uses: easimon/maximize-build-space@master - with: - root-reserve-mb: 15360 - temp-reserve-mb: 12288 - remove-dotnet: "true" - - - uses: actions/checkout@v4 - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v14 - - - name: Run the Magic Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@v8 - - - name: Create cache directories - run: | - mkdir -p ~/.buck2 ~/.cache/buck2 buck-out/cache buck-out/v2 - - # Try to restore cache before building - - uses: actions/cache/restore@v4 - id: cache-restore - with: - path: | - ~/.buck2 - ~/.cache/buck2 - buck-out - .buck-cache - .buckd - prebuilt - installed - target - key: b2-${{ matrix.cluster.name }}-${{ env.short_sha }} - restore-keys: | - b2-${{ matrix.cluster.name }}- - - - name: Build cluster - run: | - nix develop -c buck2 build ${{ matrix.cluster.targets }} - - - name: Debug cache content - run: | - echo "Buck cache structure:" - find buck-out -type d - echo "Buck output size by directory:" - du -sh buck-out/* - - - uses: actions/cache/save@v4 - with: - path: | - ~/.buck2 - ~/.cache/buck2 - buck-out - .buck-cache - .buckd - prebuilt - installed - target - key: b2-${{ matrix.cluster.name }}-${{ env.short_sha }} - enableCrossOsArchive: true - - tests: - name: execute via bats - runs-on: ubuntu-latest - timeout-minutes: 25 - needs: build - - steps: - - id: vars - run: echo "short_sha=${GITHUB_SHA:0:7}" >> $GITHUB_ENV - - - name: Maximize build space - uses: easimon/maximize-build-space@master - with: - root-reserve-mb: 15360 - temp-reserve-mb: 12288 - remove-dotnet: "true" - - - uses: actions/checkout@v4 - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v14 - - - name: Run the Magic Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@v8 - - - name: Create cache directories - run: | - mkdir -p ~/.buck2 ~/.cache/buck2 buck-out/cache buck-out/v2 - - # Modified cache restoration strategy - - name: Restore all cluster caches - uses: actions/cache/restore@v4 - with: - path: | - ~/.buck2 - ~/.cache/buck2 - buck-out - .buck-cache - .buckd - prebuilt - installed - target - key: | - b2-core-apis-${{ env.short_sha }} - restore-keys: | - b2-core-apis- - fail-on-cache-miss: true - - - name: Debug restored cache - run: | - echo "Cache directory structure:" - find buck-out -type d - echo "Cache sizes by directory:" - du -sh buck-out/* - - - name: Run bats tests - run: | - echo "Buck build status before tests:" - nix develop -c buck2 build --show-output \ - //:node_modules //core/api //core/api-ws-server //core/api-trigger //core/api-exporter - - - name: Rename Tilt log - if: always() - run: mv bats/.e2e-tilt.log bats/e2e-tilt.log - - - name: Upload Tilt log - if: always() - uses: actions/upload-artifact@v4 - with: - name: Tilt log - path: bats/e2e-tilt.log diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index b2aa376f49..455dcfbaa3 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -5,26 +5,18 @@ on: types: [opened, synchronize, labeled, unlabeled] jobs: - tests: - name: execute via tilt + prepare: + name: prepare build args runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.prepare_args.outputs.matrix }} steps: - - name: Maximize build space - uses: easimon/maximize-build-space@master - with: - root-reserve-mb: 15360 - temp-reserve-mb: 12288 - remove-dotnet: "true" - uses: actions/checkout@v4 - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v14 - - name: Run the Magic Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Prepare tilt args from labels id: prepare_args run: | - ARGS="" - BUILD_ARGS="" + # Initialize variables + MATRIX="[" cat < labels.json ${{ toJSON(github.event.pull_request.labels.*.name) }} @@ -38,78 +30,80 @@ jobs: LABELS=("${DEFAULT_LABELS[@]}") fi - # Handle 'core' dependency - for LABEL in "${LABELS[@]}"; do - case "$LABEL" in - core|dashboard|consent|pay|admin-panel|map|voucher) - BUILD_ARGS+=" //core/api:prod_build" - BUILD_ARGS+=" //core/notifications:notifications" + # Core dependencies that might be needed + CORE_DEPS="//core/api:prod_build //core/notifications:notifications //:node_modules" - break - ;; - esac - done - - # Handle root 'node_modules' dependency + # Process each label into a matrix entry for LABEL in "${LABELS[@]}"; do - case "$LABEL" in - dashboard|consent|pay|admin-panel|map|voucher) - BUILD_ARGS+=" "//:node_modules"" + BUILD_ARGS="" - break + # Add core dependencies if needed + case "$LABEL" in + core|dashboard|consent|pay|admin-panel|map|voucher) + BUILD_ARGS+=" $CORE_DEPS" ;; esac - done - # Handle 'consent' dependencies - for LABEL in "${LABELS[@]}"; do case "$LABEL" in - dashboard|voucher) + dashboard|voucher|consent) BUILD_ARGS+=" //apps/consent:consent" BUILD_ARGS+=" //core/api-keys:api-keys" - - break ;; esac - done - # Handle other labels - for LABEL in "${LABELS[@]}"; do case "$LABEL" in - core) - ARGS+=" $LABEL" - ;; - esac - - case "$LABEL" in - dashboard|consent|admin-panel|map|voucher) - ARGS+=" $LABEL" - BUILD_ARGS+=" //apps/$LABEL:$LABEL" - ;; - + core) ;; pay) - ARGS+=" $LABEL" BUILD_ARGS+=" //apps/$LABEL:$LABEL-ci" ;; + dashboard|admin-panel|map|voucher) + BUILD_ARGS+=" //apps/$LABEL:$LABEL" + ;; esac + + # Add matrix entry if we have build args + if [ ! -z "$BUILD_ARGS" ]; then + if [ "$MATRIX" != "[" ]; then + MATRIX+="," + fi + MATRIX+="{\"component\":\"$LABEL\",\"build_args\":\"$BUILD_ARGS\"}" + fi done - echo "Prepared args: $ARGS" - echo "Prepared build_args: $BUILD_ARGS" - echo "args=$ARGS" >> "$GITHUB_OUTPUT" - echo "build_args=$BUILD_ARGS" >> "$GITHUB_OUTPUT" + MATRIX+="]" + echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT" + + build-and-test: + name: build and test ${{ matrix.component }} + needs: prepare + if: needs.prepare.outputs.matrix != '[]' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: ${{ fromJSON(needs.prepare.outputs.matrix) }} + steps: + - name: Maximize build space + uses: easimon/maximize-build-space@master + with: + root-reserve-mb: 15360 + temp-reserve-mb: 12288 + remove-dotnet: "true" + - uses: actions/checkout@v4 + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v14 + - name: Run the Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Build via buck2 - if: steps.prepare_args.outputs.build_args != '' - run: nix develop -c buck2 build ${{ steps.prepare_args.outputs.build_args }} + run: nix develop -c buck2 build ${{ matrix.build_args }} - name: Start deps and run tests via tilt - if: steps.prepare_args.outputs.args != '' - run: nix develop -c xvfb-run ./dev/bin/tilt-ci.sh ${{ steps.prepare_args.outputs.args }} + run: nix develop -c xvfb-run ./dev/bin/tilt-ci.sh ${{ matrix.component }} - name: Prepare Tilt log id: prepare_tilt_log if: always() run: | TILT_LOG="dev/.e2e-tilt.log" - TARGET="dev/e2e-tilt.log" + TARGET="dev/e2e-tilt-${{ matrix.component }}.log" if [ -f "$TILT_LOG" ]; then mv "$TILT_LOG" "$TARGET" @@ -121,5 +115,5 @@ jobs: if: steps.prepare_tilt_log.outputs.prepared == 'true' uses: actions/upload-artifact@v4 with: - name: Tilt log - path: dev/e2e-tilt.log + name: Tilt log - ${{ matrix.component }} + path: dev/e2e-tilt-${{ matrix.component }}.log diff --git a/.github/workflows/integration-test2.yml b/.github/workflows/integration-test2.yml deleted file mode 100644 index 455dcfbaa3..0000000000 --- a/.github/workflows/integration-test2.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: "Integration test" -on: - pull_request: - branches: [main] - types: [opened, synchronize, labeled, unlabeled] - -jobs: - prepare: - name: prepare build args - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.prepare_args.outputs.matrix }} - steps: - - uses: actions/checkout@v4 - - name: Prepare tilt args from labels - id: prepare_args - run: | - # Initialize variables - MATRIX="[" - - cat < labels.json - ${{ toJSON(github.event.pull_request.labels.*.name) }} - EOF - - DEFAULT_LABELS=("dashboard" "consent" "pay" "core" "admin-panel" "map" "voucher") - LABELS=($(jq -r '.[]' < labels.json)) - if [ ${#LABELS[@]} -eq 0 ]; then - LABELS=("${DEFAULT_LABELS[@]}") - elif [ ${#LABELS[@]} -eq 1 ] && [ "${LABELS[0]}" = "ci" ]; then - LABELS=("${DEFAULT_LABELS[@]}") - fi - - # Core dependencies that might be needed - CORE_DEPS="//core/api:prod_build //core/notifications:notifications //:node_modules" - - # Process each label into a matrix entry - for LABEL in "${LABELS[@]}"; do - BUILD_ARGS="" - - # Add core dependencies if needed - case "$LABEL" in - core|dashboard|consent|pay|admin-panel|map|voucher) - BUILD_ARGS+=" $CORE_DEPS" - ;; - esac - - case "$LABEL" in - dashboard|voucher|consent) - BUILD_ARGS+=" //apps/consent:consent" - BUILD_ARGS+=" //core/api-keys:api-keys" - ;; - esac - - case "$LABEL" in - core) ;; - pay) - BUILD_ARGS+=" //apps/$LABEL:$LABEL-ci" - ;; - dashboard|admin-panel|map|voucher) - BUILD_ARGS+=" //apps/$LABEL:$LABEL" - ;; - esac - - # Add matrix entry if we have build args - if [ ! -z "$BUILD_ARGS" ]; then - if [ "$MATRIX" != "[" ]; then - MATRIX+="," - fi - MATRIX+="{\"component\":\"$LABEL\",\"build_args\":\"$BUILD_ARGS\"}" - fi - done - - MATRIX+="]" - echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT" - - build-and-test: - name: build and test ${{ matrix.component }} - needs: prepare - if: needs.prepare.outputs.matrix != '[]' - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: ${{ fromJSON(needs.prepare.outputs.matrix) }} - steps: - - name: Maximize build space - uses: easimon/maximize-build-space@master - with: - root-reserve-mb: 15360 - temp-reserve-mb: 12288 - remove-dotnet: "true" - - uses: actions/checkout@v4 - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v14 - - name: Run the Magic Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@v8 - - name: Build via buck2 - run: nix develop -c buck2 build ${{ matrix.build_args }} - - name: Start deps and run tests via tilt - run: nix develop -c xvfb-run ./dev/bin/tilt-ci.sh ${{ matrix.component }} - - name: Prepare Tilt log - id: prepare_tilt_log - if: always() - run: | - TILT_LOG="dev/.e2e-tilt.log" - TARGET="dev/e2e-tilt-${{ matrix.component }}.log" - - if [ -f "$TILT_LOG" ]; then - mv "$TILT_LOG" "$TARGET" - echo "prepared=true" >> "$GITHUB_OUTPUT" - else - echo "prepared=false" >> "$GITHUB_OUTPUT" - fi - - name: Upload Tilt log - if: steps.prepare_tilt_log.outputs.prepared == 'true' - uses: actions/upload-artifact@v4 - with: - name: Tilt log - ${{ matrix.component }} - path: dev/e2e-tilt-${{ matrix.component }}.log