Skip to content

Commit

Permalink
Packaging build automation fixes (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
amzn-changml authored Sep 27, 2023
1 parent 81deb51 commit 6e7933c
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 18 deletions.
23 changes: 8 additions & 15 deletions .github/workflows/build-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Checkout 3P source repo
uses: actions/checkout@v4
with:
fetch-depth: 10
fetch-depth: 0

- name: Get package and platform from JSON changes
id: detect-platform
Expand All @@ -48,7 +48,7 @@ jobs:
esac
DIFF=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \
--exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) # Get oly the changes that can be built
--exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) # Get only the changes that can be built
if [[ $? -ne 0 ]]; then
echo No valid build change found. Exiting with non-zero
Expand Down Expand Up @@ -121,6 +121,7 @@ jobs:
uses: actions/checkout@v4
with:
path: 3p-package-source
fetch-depth: 0

- name: Checkout 3P scripts repo
uses: actions/checkout@v4
Expand Down Expand Up @@ -154,25 +155,17 @@ jobs:
restore-keys:
${{ matrix.package }}-${{ matrix.os }}

- name: Run build command (windows)
if: contains(matrix.package, 'windows')
- name: Run build command
if: ${{ !contains(matrix.package, 'aarch64') }}
env:
CMAKE_CXX_COMPILER_LAUNCHER: sccache
CMAKE_C_COMPILER_LAUNCHER: sccache
CMAKE_GENERATOR: Ninja # ccache/sccache cannot be used as the compiler launcher under cmake if the generator is MSBuild
run: |
python3 3p-package-scripts/o3de_package_scripts/build_package.py --search_path 3p-package-source ${{ matrix.package }}
- name: Run build command (linux/mac)
if: contains(matrix.package, 'linux') && ${{ !contains(matrix.package, 'aarch64') }}
env:
CMAKE_CXX_COMPILER_LAUNCHER: sccache
CMAKE_C_COMPILER_LAUNCHER: sccache
run: |
python3 3p-package-scripts/o3de_package_scripts/build_package.py --search_path 3p-package-source ${{ matrix.package }}
- name: Run build command (linux aarch64)
if: contains(matrix.package, 'linux') && contains(matrix.package, 'aarch64')
- name: Run build command (aarch64)
if: contains(matrix.package, 'aarch64')
uses: uraimo/run-on-arch-action@v2.5.1
with:
arch: none
Expand Down
30 changes: 27 additions & 3 deletions .github/workflows/promote-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@
name: Promote 3P Packages

on:
# Allows you to run this workflow manually from the Actions tag
# Allows you to run this workflow manually from the Actions screen
workflow_dispatch:
inputs:
PR-num:
type: string
required: false
description: PR number to pull from. Leave blank to pull from last successful run
Run-id-num:
type: string
required: false
description: Run id number (located in the build url) to pull from. Leave blank to pull from last successful run

push:
branches:
Expand All @@ -27,10 +36,25 @@ jobs:
uses: dawidd6/action-download-artifact@v2.28.0
with:
workflow: build-pr-packages.yaml
workflow_conclusion: success
commit: ${{github.event.pull_request.head.sha}}
pr: ${{ inputs.PR-num }}
run_id: ${{ inputs.Run-id-num }}
check_artifacts: true
path: ${{ env.PACKAGE_PATH }}

- name: Check if package already exists in prod
env:
PROD_CDN: ${{ vars.PROD_CDN }} # Change this to compare on your own endpoint
run: |
find ${{ env.PACKAGE_PATH }} -type f | while read file; do
filename=$(basename "$file")
url="${{ env.PROD_CDN }}/${filename}"
if curl --head --silent --fail ${url} > /dev/null 2>&1; then
echo ${filename} already exists in prod. Check the rev in the json file to ensure it is incremented
exit 1
else
echo ${filename} does not exist in CDN, continuing...
fi
done
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
Expand Down

0 comments on commit 6e7933c

Please sign in to comment.