PromucFlow_constructor/.github/workflows/build-client-server.yml
Saroj 026daccc46
ci: add ts check in ci-test-limited (#25137)
## Description
- Added ts file check in limited workflow

#### Type of change
- Workflow file
## Testing
>
#### How Has This Been Tested?
- Workflow run
2023-07-05 22:11:02 +05:30

113 lines
3.2 KiB
YAML

name: Build Client, Server & Run only Cypress
on:
# This workflow can be triggered manually from the GitHub Actions page
workflow_dispatch:
inputs:
previous_run_id:
description: 'Run id to download the docker image artifact:'
required: false
type: string
default: "0"
jobs:
file-check:
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
non_ts_files: ${{ steps.check_files.outputs.non_ts_files }}
non_ts_files_count: ${{ steps.check_files.outputs.non_ts_files_count }}
steps:
- name: Checkout the head commit of the branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get the diff from base branch
continue-on-error: true
id: files
run: |
git fetch origin release
git diff --name-only --diff-filter=A remotes/origin/release...${{ github.ref_name }} -- 'app/client/cypress/e2e' > diff
echo "files_added=$(cat diff)" >> $GITHUB_OUTPUT
cat diff
- name: Check the newly added files are written in ts
id: check_files
run: |
files=(${{steps.files.outputs.files_added}})
non_ts_files=()
for file in "${files[@]}"; do
if [[ $file != *.ts ]]; then
non_ts_files+=("$file")
fi
done
echo "non_ts_files=${non_ts_files[@]}" >> $GITHUB_OUTPUT
echo "non_ts_files_count=${#non_ts_files[@]}" >> $GITHUB_OUTPUT
- name: Print the files
if: steps.check_files.outputs.non_ts_files_count != 0
run: |
echo "${{ steps.check_files.outputs.non_ts_files }}"
exit 1
server-build:
name: server-build
needs: [file-check]
if: success() && inputs.previous_run_id == '0'
uses: ./.github/workflows/server-build.yml
secrets: inherit
with:
pr: 0
skip-tests: "true"
client-build:
name: client-build
needs: [file-check]
if: success() && inputs.previous_run_id == '0'
uses: ./.github/workflows/client-build.yml
secrets: inherit
with:
pr: 0
skip-tests: "true"
rts-build:
name: rts-build
needs: [file-check]
if: success() && inputs.previous_run_id == '0'
uses: ./.github/workflows/rts-build.yml
secrets: inherit
with:
pr: 0
build-docker-image:
needs: [ client-build, server-build, rts-build ]
# Only run if the build step is successful
if: success() && inputs.previous_run_id == '0'
name: build-docker-image
uses: ./.github/workflows/build-docker-image.yml
secrets: inherit
with:
pr: 0
ci-test-limited:
needs: [ build-docker-image ]
# Only run if the build step is successful
if: success() && inputs.previous_run_id == '0'
name: ci-test-limited
uses: ./.github/workflows/ci-test-limited.yml
secrets: inherit
with:
pr: 0
ci-test-limited-existing-docker-image:
needs: [file-check]
# Only run if the previous run-id is provided
if: success() && inputs.previous_run_id != '0'
name: ci-test-limited-existing-image
uses: ./.github/workflows/ci-test-limited.yml
secrets: inherit
with:
pr: 0
previous-workflow-run-id: ${{ fromJson(inputs.previous_run_id) }}