chore: update actions/github-script action to v8 #2862
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
name: build | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
types: | |
- closed | |
- opened | |
- reopened | |
- synchronize | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
outputs: | |
buildAffectedPackages: ${{ steps.get-build-affected-packages.outputs.packages }} | |
testAffectedPackages: ${{ steps.get-test-affected-packages.outputs.packages }} | |
if: "!(github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == false)" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup | |
- name: Get build affected packages | |
id: get-build-affected-packages | |
run: echo "packages=$(pnpm exec foundation-get-affected-projects build origin/${{github.base_ref}})" >> $GITHUB_OUTPUT | |
- name: Get test affected packages | |
id: get-test-affected-packages | |
run: echo "packages=$(pnpm exec foundation-get-affected-project-chunks test origin/${{github.base_ref}} 4)" >> $GITHUB_OUTPUT | |
- name: Compile source files | |
run: pnpm run build | |
- name: Lint affected source files | |
run: pnpm run lint --filter=[origin/${{github.base_ref}}] | |
- name: Check for unused code | |
run: pnpm run unused --no-config-hints | |
run-container-benchmarks: | |
name: Run container benchmarks | |
environment: CI | |
needs: build | |
runs-on: ubuntu-latest | |
if: ${{ contains(needs.build.outputs.buildAffectedPackages, '@inversifyjs/container-benchmarks') && github.event.pull_request.head.repo.fork != true }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup | |
- name: Compile source files | |
run: pnpm run build | |
- name: Run benchmarks (CommonJS) | |
id: run-cjs-benchmarks | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "result<<$EOF" >> $GITHUB_OUTPUT | |
echo "$(pnpm run benchmarks:container:cjs)" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- name: Run benchmarks (ESM) | |
id: run-esm-benchmarks | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "result<<$EOF" >> $GITHUB_OUTPUT | |
echo "$(pnpm run benchmarks:container:esm)" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- uses: actions/github-script@v8 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `Benchmarks results: | |
--- | |
\`\`\`bash | |
${{steps.run-cjs-benchmarks.outputs.result}} | |
\`\`\` | |
\`\`\`bash | |
${{steps.run-esm-benchmarks.outputs.result}} | |
\`\`\`` | |
}) | |
run-http-benchmarks: | |
name: Run http benchmarks | |
environment: CI | |
needs: build | |
runs-on: ubuntu-latest | |
if: >- | |
${{ | |
( | |
contains(needs.build.outputs.buildAffectedPackages, '@inversifyjs/http-benchmarks') | |
) && github.event.pull_request.head.repo.fork != true | |
}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup | |
- name: Setup K6 | |
uses: grafana/setup-k6-action@v1 | |
- name: Compile source files | |
run: pnpm run build | |
- name: Run benchmarks (CommonJS) | |
id: run-cjs-benchmarks | |
run: | | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "result<<$EOF" >> $GITHUB_OUTPUT | |
echo "$(pnpm run benchmarks:http:cjs:low)" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- uses: actions/github-script@v8 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `Benchmarks results: | |
--- | |
\`\`\`bash | |
${{steps.run-cjs-benchmarks.outputs.result}} | |
\`\`\`` | |
}) | |
test-package: | |
name: Test package | |
needs: build | |
runs-on: ubuntu-latest | |
if: ${{ needs.build.outputs.testAffectedPackages != '[]' }} | |
strategy: | |
matrix: | |
packages: ${{fromJSON(needs.build.outputs.testAffectedPackages)}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup | |
- name: Launch Unit Tests | |
run: pnpm run test:unit --filter ${{ join(matrix.packages, ' --filter ') }} | |
- name: Launch Integration Tests | |
run: pnpm run test:integration --filter ${{ join(matrix.packages, ' --filter ') }} | |
test-e2e-container: | |
name: Run container E2E tests. | |
needs: build | |
runs-on: ubuntu-latest | |
if: >- | |
${{ | |
contains(needs.build.outputs.buildAffectedPackages, '@inversifyjs/container-e2e-tests') | |
}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup | |
- name: Run e2e tests (CJS) | |
run: pnpm run test:e2e:cjs --filter='@inversifyjs/container-e2e-tests' | |
- name: Run e2e tests (ESM) | |
run: pnpm run test:e2e:esm --filter='@inversifyjs/container-e2e-tests' | |
test-e2e-http: | |
name: Run http E2E tests. | |
needs: build | |
runs-on: ubuntu-latest | |
if: >- | |
( | |
${{ contains(needs.build.outputs.buildAffectedPackages, '@inversifyjs/http-e2e-tests')}} | |
) | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup | |
- name: Run e2e tests (CJS) | |
run: pnpm run test:e2e:cjs --filter='@inversifyjs/http-e2e-tests' | |
- name: Run e2e tests (ESM) | |
run: pnpm run test:e2e:esm --filter='@inversifyjs/http-e2e-tests' | |
done: | |
name: Done | |
needs: | |
- test-e2e-container | |
- test-e2e-http | |
- test-package | |
runs-on: ubuntu-latest | |
steps: | |
- run: 'echo "Done!"' |