EMSUSD-1891 Don't dirty stage when loading #5149
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: Pre-flight build on pull request | |
# Trigger the workflow on pull request (assigned) event for the branch | |
# https://help.github.com/en/actions/reference/events-that-trigger-workflows | |
on: | |
pull_request: | |
branches: [dev] | |
types: [assigned] | |
jobs: | |
clang_format_linter: | |
timeout-minutes: 30 | |
runs-on: ubuntu-22.04 | |
# Start clang format by assigning pull-request to yourself. | |
if: ${{ github.event.assignee.login == github.event.pull_request.user.login }} | |
steps: | |
# Feb 2024: Update from v3 to v4 which uses node20 (node16 is out of support). | |
- uses: actions/checkout@v4 | |
- uses: DoozyX/clang-format-lint-action@v0.17 | |
with: | |
source: '.' | |
clangFormatVersion: 10 | |
# Wait for remote build to start and finish, report results | |
build_preflight: | |
timeout-minutes: 400 | |
runs-on: ubuntu-22.04 | |
needs: clang_format_linter | |
# Start preflight by assigning pull-request to yourself. | |
if: ${{ github.event.assignee.login == github.event.pull_request.user.login }} | |
steps: | |
# Build start info will be committed here when the remote build is launched | |
- name: Setup transfer repo | |
uses: actions/checkout@v4 | |
with: | |
repository: ecp-maya-devops-adsk/log-transfer | |
ref: transfer | |
path: transfer | |
# Echo the file name - it's hard to find the run_id in the UI | |
- name: Echo the expected start file name | |
run: "echo ${{ github.run_id }}_${{ github.run_number }}_start.txt" | |
# Wait for remote build to start | |
- name: Wait until remote build starts | |
shell: bash | |
# 180 minutes wait time. There will be overhead for the git pull command, so actual wait time will be slightly more than 180 minutes | |
run: "cd transfer ; for (( i=0; i<180; i++ )) ; do if [ -f ${{ github.run_id }}_${{ github.run_number }}_start.txt ] ; then break ; fi ; git pull --quiet ; sleep 60 ; false ; done || exit 1" | |
# Show contents of start file | |
- name: Show build start information | |
shell: bash | |
run: "cat transfer/${{ github.run_id }}_${{ github.run_number }}_start.txt" | |
# Grep the start file to show failures | |
- name: Exit with error if a build failed to start | |
# Default shell includes "-o pipefail" and "-e". Specify a different shell | |
shell: bash --noprofile --norc {0} | |
run: "if grep -i 'Remote build failed' transfer/${{ github.run_id }}_${{ github.run_number }}_start.txt; then exit 1; else exit 0; fi" | |
# Echo the file name - it's hard to find the run_id in the UI | |
- name: Echo the expected result file name | |
run: "echo ${{ github.run_id }}_${{ github.run_number }}_result.txt" | |
# Wait for remote build to finish and commit results to git | |
- name: Wait until build results are available | |
shell: bash | |
# 180 minutes wait time. There will be overhead for the git pull command, so actual wait time will be slightly more than 180 minutes | |
run: "cd transfer ; for (( i=0; i<180; i++ )) ; do if [ -f ${{ github.run_id }}_${{ github.run_number }}_result.txt ] ; then break ; fi ; git pull --quiet ; sleep 60 ; false ; done || exit 1" | |
# List files related to this build | |
- name: List files in transfer directory | |
shell: bash | |
run: "ls -lap transfer/${{ github.run_id }}_${{ github.run_number }}_*" | |
# Upload files related to this build | |
- name: Upload files in transfer directory as artifacts | |
# Feb 2024: Update from v3 to v4 which uses node20 (node16 is out of support). | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build logs | |
path: "transfer/${{ github.run_id }}_${{ github.run_number }}_*" | |
# Show contents of result file | |
- name: Show build result information | |
shell: bash | |
run: "cat transfer/${{ github.run_id }}_${{ github.run_number }}_result.txt" | |
# Grep the results file to show failures | |
- name: Exit with error if a build failed | |
# Default shell includes "-o pipefail" and "-e". Specify a different shell | |
shell: bash --noprofile --norc {0} | |
run: "if grep -i failed transfer/${{ github.run_id }}_${{ github.run_number }}_result.txt; then exit 1; else exit 0; fi" |