feat(aws): storage.elasticache — elasticache-alpha port [stacked on #150] #983
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ~~ Generated by projen. To modify, edit .projenrc.ts and run "pnpm exec projen". | |
| name: build | |
| on: | |
| pull_request: {} | |
| workflow_dispatch: {} | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| outputs: | |
| self_mutation_happened: ${{ steps.self_mutation.outputs.self_mutation_happened }} | |
| artifact_id: ${{ steps.upload_artifact.outputs.artifact-id }} | |
| env: | |
| CI: "true" | |
| SKIP_JEST: "true" | |
| LEAN_BOOTSTRAP: "true" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| - name: set up Docker | |
| if: ${{ env.LEAN_BOOTSTRAP != 'true' }} | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f | |
| - name: Load docker images | |
| id: docker-cache | |
| if: ${{ env.LEAN_BOOTSTRAP != 'true' }} | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 | |
| with: | |
| path: ~/.docker-images.tar | |
| key: docker-cache-${{ runner.os }} | |
| - name: Restore docker images | |
| if: ${{ env.LEAN_BOOTSTRAP != 'true' && steps.docker-cache.outputs.cache-hit }} | |
| run: docker image load --input ~/.docker-images.tar | |
| - if: ${{ env.LEAN_BOOTSTRAP != 'true' }} | |
| uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff | |
| with: | |
| go-version: ^1.23.0 | |
| - if: ${{ env.LEAN_BOOTSTRAP != 'true' }} | |
| uses: oven-sh/setup-bun@f4d14e03ff726c06358e5557344e1da148b56cf7 | |
| with: | |
| bun-version: 1.1.26 | |
| - if: ${{ env.LEAN_BOOTSTRAP != 'true' }} | |
| uses: opentofu/setup-opentofu@9d84900f3238fab8cd84ce47d658d25dd008be2f | |
| with: | |
| tofu_wrapper: false | |
| tofu_version: 1.8.2 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 | |
| with: | |
| version: 11.5.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 | |
| with: | |
| node-version: 24.12.0 | |
| package-manager-cache: false | |
| - name: Install dependencies | |
| run: pnpm i --no-frozen-lockfile | |
| - name: build | |
| run: pnpm exec projen build | |
| - name: Export Docker images | |
| if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
| run: docker image save --output ~/.docker-images.tar $(docker image list --format '{{ if ne .Repository "<none>" }}{{ .Repository }}{{ if ne .Tag "<none>" }}:{{ .Tag }}{{ end }}{{ else }}{{ .ID }}{{ end }}') | |
| - name: Cache Docker images | |
| if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 | |
| with: | |
| path: ~/.docker-images.tar | |
| key: docker-cache-${{ runner.os }} | |
| - name: Find mutations | |
| id: self_mutation | |
| run: |- | |
| git add . | |
| git diff --staged --patch --exit-code > repo.patch || echo "self_mutation_happened=true" >> $GITHUB_OUTPUT | |
| shell: bash | |
| working-directory: ./ | |
| - name: Upload patch | |
| if: steps.self_mutation.outputs.self_mutation_happened | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a | |
| with: | |
| name: repo.patch | |
| path: repo.patch | |
| overwrite: true | |
| - name: Fail build on mutation | |
| if: steps.self_mutation.outputs.self_mutation_happened | |
| run: |- | |
| echo "::error::Files were changed during build (see build log). If this was triggered from a fork, you will need to update your branch." | |
| cat repo.patch | |
| exit 1 | |
| - name: Backup artifact permissions | |
| run: cd dist && getfacl -R . > permissions-backup.acl | |
| continue-on-error: true | |
| - name: Upload artifact | |
| id: upload_artifact | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a | |
| with: | |
| name: build-artifact | |
| path: dist | |
| overwrite: true | |
| self-mutation: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| if: always() && needs.build.outputs.self_mutation_happened && !(github.event.pull_request.head.repo.full_name != github.repository) | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 | |
| with: | |
| token: ${{ secrets.PROJEN_GITHUB_TOKEN }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| - name: Download patch | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c | |
| with: | |
| name: repo.patch | |
| path: ${{ runner.temp }} | |
| - name: Apply patch | |
| run: '[ -s ${{ runner.temp }}/repo.patch ] && git apply ${{ runner.temp }}/repo.patch || echo "Empty patch. Skipping."' | |
| - name: Set git identity | |
| run: |- | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Push changes | |
| env: | |
| PULL_REQUEST_REF: ${{ github.event.pull_request.head.ref }} | |
| run: |- | |
| git add . | |
| git commit -s -m "chore: self mutation" | |
| git push origin "HEAD:$PULL_REQUEST_REF" | |
| package-js: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| if: ${{ !needs.build.outputs.self_mutation_happened }} | |
| steps: | |
| - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 | |
| with: | |
| node-version: 24.12.0 | |
| package-manager-cache: false | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c | |
| with: | |
| artifact-ids: ${{ needs.build.outputs.artifact_id }} | |
| path: dist | |
| - name: Restore build artifact permissions | |
| run: cd dist && setfacl --restore=permissions-backup.acl | |
| continue-on-error: true | |
| - name: set up Docker | |
| if: ${{ env.LEAN_BOOTSTRAP != 'true' }} | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f | |
| - name: Load docker images | |
| id: docker-cache | |
| if: ${{ env.LEAN_BOOTSTRAP != 'true' }} | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 | |
| with: | |
| path: ~/.docker-images.tar | |
| key: docker-cache-${{ runner.os }} | |
| - name: Restore docker images | |
| if: ${{ env.LEAN_BOOTSTRAP != 'true' && steps.docker-cache.outputs.cache-hit }} | |
| run: docker image load --input ~/.docker-images.tar | |
| - if: ${{ env.LEAN_BOOTSTRAP != 'true' }} | |
| uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff | |
| with: | |
| go-version: ^1.23.0 | |
| - if: ${{ env.LEAN_BOOTSTRAP != 'true' }} | |
| uses: oven-sh/setup-bun@f4d14e03ff726c06358e5557344e1da148b56cf7 | |
| with: | |
| bun-version: 1.1.26 | |
| - if: ${{ env.LEAN_BOOTSTRAP != 'true' }} | |
| uses: opentofu/setup-opentofu@9d84900f3238fab8cd84ce47d658d25dd008be2f | |
| with: | |
| tofu_wrapper: false | |
| tofu_version: 1.8.2 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 | |
| with: | |
| version: 11.5.0 | |
| - name: Checkout | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| path: .repo | |
| - name: Install Dependencies | |
| run: cd .repo && pnpm i --frozen-lockfile | |
| - name: Extract build artifact | |
| run: tar --strip-components=1 -xzvf dist/js/*.tgz -C .repo | |
| - name: Move build artifact out of the way | |
| run: mv dist dist.old | |
| - name: Create js artifact | |
| run: cd .repo && pnpm exec projen package:js | |
| - name: Collect js artifact | |
| run: mv .repo/dist dist | |
| env: | |
| LEAN_BOOTSTRAP: "true" | |
| test: | |
| name: test (${{ matrix.shard }}/5) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| CI: "true" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| shard: | |
| - 1 | |
| - 2 | |
| - 3 | |
| - 4 | |
| - 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 | |
| with: | |
| version: 11.5.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 | |
| with: | |
| node-version: 24.12.0 | |
| package-manager-cache: false | |
| - name: Install dependencies | |
| run: pnpm i --no-frozen-lockfile | |
| - name: Cache jest transform | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 | |
| with: | |
| path: ${{ runner.temp }}/jest-cache | |
| key: jest-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }} | |
| restore-keys: |- | |
| jest-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}- | |
| jest-${{ runner.os }}- | |
| - name: test | |
| run: pnpm exec jest --ci --coverage=false --cacheDirectory ${{ runner.temp }}/jest-cache --shard=${{ matrix.shard }}/5 --testPathIgnorePatterns "/node_modules/" "test/aws/compute/function-nodejs/docker.test.ts" | |
| test-docker: | |
| name: test (docker) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| CI: "true" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| persist-credentials: false | |
| - name: set up Docker | |
| uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f | |
| - name: Load docker images | |
| id: docker-cache | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 | |
| with: | |
| path: ~/.docker-images.tar | |
| key: docker-cache-${{ runner.os }} | |
| - name: Restore docker images | |
| if: ${{ steps.docker-cache.outputs.cache-hit }} | |
| run: docker image load --input ~/.docker-images.tar | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 | |
| with: | |
| version: 11.5.0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 | |
| with: | |
| node-version: 24.12.0 | |
| package-manager-cache: false | |
| - name: Install dependencies | |
| run: pnpm i --no-frozen-lockfile | |
| - name: test | |
| run: pnpm exec jest --ci --coverage=false --runTestsByPath test/aws/compute/function-nodejs/docker.test.ts | |
| tests: | |
| name: tests | |
| needs: | |
| - test | |
| - test-docker | |
| if: always() | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Check test results | |
| run: |- | |
| if [ "${{ needs.test.result }}" != "success" ] || [ "${{ needs.test-docker.result }}" != "success" ]; then | |
| echo "::error::test shards: ${{ needs.test.result }}, docker tests: ${{ needs.test-docker.result }}" | |
| exit 1 | |
| fi | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true |