diff --git a/.github/workflows/cleanup.yaml b/.github/workflows/cleanup.yaml index 0004b3202..9e4aad7e9 100644 --- a/.github/workflows/cleanup.yaml +++ b/.github/workflows/cleanup.yaml @@ -19,22 +19,29 @@ jobs: PR_REF="refs/pull/${{ github.event.pull_request.number }}/merge" echo "Cleaning develop branch caches (excluding benchmarks)..." + cacheKeys=$(gh cache list --ref $BRANCH_REF --limit 100 --json key,id --jq '.[] | select(.key | contains("-benchmark") | not) | .id') + for key in $cacheKeys; do echo "Cache \"$key will\" will be deleted" gh cache delete $key done echo "Cleaning PR caches (excluding benchmarks)..." + prCacheKeys=$(gh cache list --ref $PR_REF --limit 100 --json key,id --jq '.[] | select(.key | contains("-benchmark") | not) | .id') + for key in $prCacheKeys; do echo "Cache \"$key will\" will be deleted" gh cache delete $key done else BRANCH_REF="refs/pull/${{ github.event.pull_request.number }}/merge" + echo "Cleaning PR caches (excluding benchmarks)..." + cacheKeys=$(gh cache list --ref $BRANCH_REF --limit 100 --json key,id --jq '.[] | select(.key | contains("-benchmark") | not) | .id') + for key in $cacheKeys; do echo "Cache \"$key will\" will be deleted" gh cache delete $key diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml index 212e2f7ad..61edd2766 100644 --- a/.github/workflows/npm.yml +++ b/.github/workflows/npm.yml @@ -41,7 +41,9 @@ jobs: target: aarch64-unknown-linux-gnu docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 build: pnpm run --filter @stylexswc/rs-compiler build --target aarch64-unknown-linux-gnu - name: stable - ${{ matrix.settings.target }} - node@18 + node: + - '20' + name: ๐Ÿ› ๏ธ Build - ${{ matrix.settings.target }} - node@${{ matrix.settings.target }} runs-on: ${{ matrix.settings.host }} steps: - name: Enable long path support @@ -80,7 +82,7 @@ jobs: path: crates/stylex-rs-compiler/dist/${{ env.APP_NAME }}.*.node if-no-files-found: error test-macOS-windows-binding: - name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} + name: ๐Ÿงช Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} needs: - build strategy: @@ -126,7 +128,7 @@ jobs: - name: Test bindings run: pnpm run --filter @stylexswc/rs-compiler test test-linux-x64-gnu-binding: - name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }} + name: ๐Ÿงช Test bindings on Linux-x64-gnu - node@${{ matrix.node }} needs: - build strategy: @@ -162,7 +164,7 @@ jobs: pnpm run --filter @stylexswc/rs-compiler test " test-linux-x64-musl-binding: - name: Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }} + name: ๐Ÿงช Test bindings on x86_64-unknown-linux-musl - node@${{ matrix.node }} needs: - build strategy: @@ -198,7 +200,7 @@ jobs: pnpm run --filter @stylexswc/rs-compiler test " benchmark: - name: Benchmark on ${{ matrix.settings.target }} - node@${{ matrix.node }} + name: ๐Ÿ“Š Benchmark on ${{ matrix.settings.target }} - node@${{ matrix.node }} needs: - build strategy: @@ -268,7 +270,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} publish: - name: Publish + name: ๐Ÿ“ฆ Publish runs-on: ubuntu-latest needs: - build @@ -306,3 +308,37 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_CONFIG_PROVENANCE: true + cleanup: + if: always() + needs: [publish] + runs-on: ubuntu-latest + steps: + - name: ๐Ÿงน Cleanup Caches + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Wait for cache propagation + sleep 10 + + echo "๐Ÿ” Listing caches..." + + # Get cache keys excluding benchmarks + cacheKeys=$(gh cache list \ + --ref "${{ github.ref }}" \ + --limit 100 \ + --json key,id \ + --jq '.[] | select(.key | contains("-benchmark") | not) | .id') + + if [ -z "$cacheKeys" ]; then + echo "โ„น๏ธ No caches found to clean" + exit 0 + fi + + # Delete each cache + echo "๐Ÿ—‘๏ธ Deleting caches..." + for key in $cacheKeys; do + echo "Deleting cache: $key" + gh cache delete "$key" --confirm + done + + echo "โœ… Cache cleanup completed"