From a5f028ba40c1b481ef013a679d086c17778a3b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0t=C4=9Bp=C3=A1n=20Brychta?= Date: Mon, 16 Sep 2024 10:14:45 +0100 Subject: [PATCH] GitHub Action refactoring #5780 --- .../post-eviction-report-comment.js} | 0 .../{release.yml => report-evictions.yml} | 48 ++++--------------- .github/workflows/run-tests.yml | 27 +++++++++++ 3 files changed, 36 insertions(+), 39 deletions(-) rename .github/{workflows/post-evictions-comment.js => scripts/post-eviction-report-comment.js} (100%) rename .github/workflows/{release.yml => report-evictions.yml} (50%) create mode 100644 .github/workflows/run-tests.yml diff --git a/.github/workflows/post-evictions-comment.js b/.github/scripts/post-eviction-report-comment.js similarity index 100% rename from .github/workflows/post-evictions-comment.js rename to .github/scripts/post-eviction-report-comment.js diff --git a/.github/workflows/release.yml b/.github/workflows/report-evictions.yml similarity index 50% rename from .github/workflows/release.yml rename to .github/workflows/report-evictions.yml index 9748e056..cb4949c2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/report-evictions.yml @@ -1,52 +1,22 @@ -name: "Release scala-libs" +name: "Report evictions" on: pull_request: types: [opened, edited, synchronize] -env: - SERVICES: '["http"]' - permissions: id-token: write issues: write pull-requests: write - actions: 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) }} + service: + - http + - fixtures steps: - uses: actions/checkout@v4 - uses: aws-actions/configure-aws-credentials@v4 @@ -55,16 +25,16 @@ jobs: 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 }} + - name: Run eviction report for ${{ matrix.service }} + run: ./builds/report_sbt_evictions.sh ${{ matrix.service }} 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 }} + name: evicted_${{ matrix.service }} + path: .reports/evicted_${{ matrix.service }} collate-evictions: runs-on: ubuntu-latest @@ -87,5 +57,5 @@ jobs: uses: actions/github-script@v6 with: script: | - const postComment = require('./.github/workflows/post-evictions-comment.js'); + const postComment = require('./.github/scripts/post-eviction-report-comment.js'); await postComment(github, context); diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 00000000..6cdbd841 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,27 @@ +name: "Run tests" + +on: + pull_request: + types: [opened, edited, synchronize] + +permissions: + id-token: write + +jobs: + run-tests: + runs-on: ubuntu-latest + strategy: + matrix: + service: + - http + - fixtures + 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.service }}