Migrate buildkite pipeline to github action #5780 #29
This file contains 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: "Release scala-libs" | |
on: push | |
env: | |
SERVICES: '["http", "fixtures"]' | |
permissions: | |
id-token: write | |
jobs: | |
matrix-config: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.prepare.outputs.matrix }} | |
steps: | |
- name: Prepare matrix JSON Object | |
id: prepare | |
run: echo 'matrix=${{ env.SERVICES }}' >> $GITHUB_OUTPUT | |
test: | |
runs-on: ubuntu-latest | |
needs: matrix-config | |
strategy: | |
matrix: | |
name: ${{ fromJSON(needs.matrix-config.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: eu-west-1 | |
role-to-assume: ${{ secrets.GHA_SCALA_LIBS_ROLE_ARN }} | |
- uses: aws-actions/amazon-ecr-login@v2 | |
- name: Run sbt tests | |
run: ./builds/run_sbt_tests.sh ${{ matrix.name }} | |
report-evictions: | |
runs-on: ubuntu-latest | |
needs: matrix-config | |
strategy: | |
matrix: | |
name: ${{ fromJSON(needs.matrix-config.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: eu-west-1 | |
role-to-assume: ${{ secrets.GHA_SCALA_LIBS_ROLE_ARN }} | |
- uses: aws-actions/amazon-ecr-login@v2 | |
- name: Run eviction report for ${{ matrix.name }} | |
run: ./builds/report_sbt_evictions.sh ${{ matrix.name }} | |
continue-on-error: true | |
- name: Upload eviction reports | |
if: always() # This ensures it runs even if the previous step fails | |
uses: actions/upload-artifact@v4 | |
with: | |
name: evicted_${{ matrix.name }} | |
path: .reports/evicted_${{ matrix.name }} | |
collate-evictions: | |
runs-on: ubuntu-latest | |
needs: report-evictions | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Download eviction reports | |
uses: actions/download-artifact@v4 | |
with: | |
path: .reports/ | |
- name: Collate evictions | |
run: | | |
ls -la | |
ls -la .reports | |
mkdir -p .reports | |
builds/report_unique_evictions.sh | tee unique_evictions.txt | |
- name: Post eviction report comment | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const fs = require('fs'); | |
const reportContent = fs.readFileSync('unique_evictions.txt', 'utf8'); | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: reportContent | |
}); |