PIN-7933: Analytics - align purpose template risk analysis schema #24561
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: PR validation | |
on: | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
formatting: | |
name: Check formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Cache turbo setup | |
uses: actions/cache@638ed79f9dc94c1de1baef91bcab5edaa19451f4 | |
with: | |
path: | | |
.turbo | |
packages/*/.turbo | |
key: ${{ runner.os }}-turbo-check-formatting-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-turbo-check-formatting | |
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4 | |
with: | |
run_install: true | |
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
with: | |
node-version-file: ./package.json | |
- run: pnpm format:check | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Cache turbo setup | |
uses: actions/cache@638ed79f9dc94c1de1baef91bcab5edaa19451f4 | |
with: | |
path: | | |
.turbo | |
packages/*/.turbo | |
key: ${{ runner.os }}-turbo-lint-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-turbo-lint- | |
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
with: | |
node-version-file: ./package.json | |
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4 | |
with: | |
run_install: true | |
- run: pnpm lint | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Cache turbo setup | |
uses: actions/cache@638ed79f9dc94c1de1baef91bcab5edaa19451f4 | |
with: | |
path: | | |
.turbo | |
packages/*/.turbo | |
key: ${{ runner.os }}-turbo-check-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-turbo-check | |
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
with: | |
node-version-file: ./package.json | |
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4 | |
with: | |
run_install: true | |
- run: pnpm check | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Cache turbo setup | |
uses: actions/cache@638ed79f9dc94c1de1baef91bcab5edaa19451f4 | |
with: | |
path: | | |
.turbo | |
packages/*/.turbo | |
key: ${{ runner.os }}-turbo-test-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-turbo-test | |
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | |
with: | |
node-version-file: ./package.json | |
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4 | |
with: | |
run_install: true | |
- run: pnpm test | |
lint-openapi: | |
name: Lint Open Api specification | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: stoplightio/spectral-action@6416fd018ae38e60136775066eb3e98172143141 # v0.8.13 | |
with: | |
file_glob: "./packages/api-clients/open-api/!(selfcareV2ClientApi.yml|authorizationManagementApi.yaml|notifierApi.yml|apiGatewayApi.yml)" | |
find_dockerfiles: | |
name: Find Dockerfiles | |
needs: [formatting, lint, check, test, lint-openapi] | |
if: ${{ github.base_ref == 'develop' || github.base_ref == 'main' }} | |
runs-on: ubuntu-latest | |
outputs: | |
packages: ${{ steps.set_packages_output.outputs.packages }} | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Find packages | |
id: set_packages_output | |
run: | | |
PACKAGES=$(find packages -type f -path "*/Dockerfile" | awk -F'/' '{print $2}' | jq -R -s -c 'split("\n")[:-1]') | |
echo "packages=$PACKAGES" >> $GITHUB_OUTPUT | |
docker_build: | |
name: Build | |
needs: [find_dockerfiles] | |
if: ${{ github.base_ref == 'main' }} | |
runs-on: ubuntu-latest | |
environment: ecr-ro | |
permissions: | |
contents: read | |
id-token: write | |
strategy: | |
max-parallel: 5 | |
fail-fast: false | |
matrix: | |
package: ${{ fromJson(needs.find_dockerfiles.outputs.packages) }} | |
env: | |
DOCKER_BUILD_SUMMARY: "false" | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4 | |
with: | |
aws-region: ${{ vars.AWS_REGION }} | |
role-to-assume: ${{ vars.IAM_ROLE_ARN }} | |
role-session-name: be-monorepo-pr-validation-${{ github.run_number }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2 | |
- name: Build Docker image | |
uses: docker/build-push-action@55146d969b0dff1a5c12630229609757af5b1081 | |
with: | |
context: . | |
file: packages/${{ matrix.package }}/Dockerfile | |
build-args: | | |
NODE_REGISTRY=${{ vars.NODE_REGISTRY }} | |
push: false | |
check_build_result: | |
name: Build Result | |
needs: [docker_build] | |
if: ${{ always() && github.base_ref == 'main' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check build result | |
run: | | |
[[ ${{ needs.docker_build.result }} != 'success' ]] && exit 1 | |
exit 0 |