chore(concierge): fix visitor checkin/out times (PPT-1799) #3206
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
# This is a basic workflow to help you get started with Actions | |
name: BUILD | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [develop, release/**, rc/**, release] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
install_deps: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '2' | |
- name: Cache node modules | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: NPM install | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm install --force | |
- name: Get short hash | |
id: vars | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Extract branch name | |
id: branch_name | |
shell: bash | |
run: echo "name=$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" >> $GITHUB_OUTPUT | |
- name: Extract build configuration | |
shell: bash | |
id: build_ext | |
run: | | |
if [[ ${{ steps.branch_name.outputs.name }} == "release" ]] || [[ ${{ steps.branch_name.outputs.name }} == "release"* ]] || [[ ${{ steps.branch_name.outputs.name }} == "main" ]] | |
then | |
echo "configuration=production" >> $GITHUB_OUTPUT | |
echo "deploy_branch=prod" >> $GITHUB_OUTPUT | |
elif [[ ${{ steps.branch_name.outputs.name }} == "rc"* ]] | |
then | |
echo "configuration=staging" >> $GITHUB_OUTPUT | |
echo "deploy_branch=uat" >> $GITHUB_OUTPUT | |
else | |
echo "configuration=staging" >> $GITHUB_OUTPUT | |
echo "deploy_branch=dev" >> $GITHUB_OUTPUT | |
fi | |
- name: List affected applications | |
id: affected_apps | |
run: | | |
echo "affected_apps=$(node ./tools/get-affected.js ${{ github.ref }})" >> $GITHUB_OUTPUT | |
echo "affected_units=$(node ./tools/get-affected.js ${{ github.ref }} test)" >> $GITHUB_OUTPUT | |
- name: Print affected applications | |
run: | | |
echo ${{ steps.affected_apps.outputs.affected_apps }} | |
outputs: | |
affected_apps: ${{ steps.affected_apps.outputs.affected_apps }} | |
affected_units: ${{ steps.affected_apps.outputs.affected_units }} | |
configuration: ${{ steps.build_ext.outputs.configuration }} | |
deploy_branch: ${{ steps.build_ext.outputs.deploy_branch }} | |
short_sha: ${{ steps.vars.outputs.short_sha }} | |
test: | |
runs-on: ubuntu-latest | |
needs: install_deps | |
if: ${{ fromJSON(needs.install_deps.outputs.affected_units)[0] != null }} | |
strategy: | |
matrix: | |
package: ${{ fromJSON(needs.install_deps.outputs.affected_units) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache node modules | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Cache nx build cache | |
id: cache-nx | |
uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/nx | |
key: ${{ runner.os }}-nx-${{matrix.package}}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nx-${{matrix.package}}- | |
${{ runner.os }}-nx- | |
- name: Setup version | |
run: npm run postinstall | |
- name: Test affected code units | |
run: | | |
npx nx test ${{ matrix.package }} --runInBand | |
build: | |
runs-on: ubuntu-latest | |
needs: install_deps | |
if: ${{ fromJSON(needs.install_deps.outputs.affected_apps)[0] != null }} | |
strategy: | |
matrix: | |
package: ${{ fromJSON(needs.install_deps.outputs.affected_apps) }} | |
env: | |
configuration: ${{ needs.install_deps.outputs.configuration }} | |
deploy_branch: ${{ needs.install_deps.outputs.deploy_branch }} | |
short_sha: ${{ needs.install_deps.outputs.short_sha }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache node modules | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Cache nx build cache | |
id: cache-nx | |
uses: actions/cache@v4 | |
with: | |
path: node_modules/.cache/nx | |
key: ${{ runner.os }}-nx-${{matrix.package}}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nx-${{matrix.package}}- | |
${{ runner.os }}-nx- | |
- name: Setup version | |
run: npm run postinstall | |
- name: Initialise Pipeline Chat Status | |
uses: fjogeleit/http-request-action@master | |
continue-on-error: true | |
with: | |
url: ${{ secrets.STATUS_URL }} | |
data: '{ "chat_url": "${{ secrets.CHAT_URL }}", "name": "${{ github.repository }}", "commit": "${{ github.sha }}", "pipeline_name": "${{ matrix.package }}", "branch": "${{ github.ref }}", "status": "processing", "url": "https://github.com/${{ github.repository }}/runs/${{ github.run_id }}" }' | |
- name: Build affected applications | |
run: | | |
npx nx build ${{ matrix.package }} --verbose --configuration=${{ env.configuration }} | |
- name: Deploy the application(${{ matrix.package }}) | |
uses: s0/git-publish-subdir-action@develop | |
env: | |
REPO: self | |
BRANCH: build/${{ matrix.package }}/${{ env.deploy_branch }} # The branch name where you want to push the assets | |
FOLDER: dist/apps/${{ matrix.package }}/browser # The directory where your assets are generated | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token | |
MESSAGE: 'build(${{ matrix.package }}): CI build from {sha}' # The commit message | |
- name: Update Pipeline Chat Status | |
uses: fjogeleit/http-request-action@master | |
continue-on-error: true | |
with: | |
url: ${{ secrets.STATUS_URL }} | |
data: '{ "name": "${{ github.repository }}", "commit": "${{ github.sha }}", "pipeline_name": "${{ matrix.package }}", "branch": "${{ github.ref }}", "status": "${{ job.status }}", "url": "https://github.com/${{ github.repository }}/runs/${{ github.run_id }}" }' | |
if: ${{ always() }} |