Skip to content

Commit

Permalink
ci:carbonix_build.yml s3 upload login changed to suit new structure
Browse files Browse the repository at this point in the history
  • Loading branch information
loki077 committed Dec 16, 2024
1 parent 1bd52c1 commit f843aa3
Showing 1 changed file with 5 additions and 126 deletions.
131 changes: 5 additions & 126 deletions .github/workflows/carbonix_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -418,122 +418,11 @@ jobs:
path: artifacts
retention-days: 90

build-apj:
runs-on: ubuntu-22.04
container: ardupilot/ardupilot-dev-${{ matrix.toolchain }}:v0.1.3
strategy:
fail-fast: false # don't cancel if a job from the matrix fails
matrix:
toolchain: [
chibios,
#chibios-clang,
]
gcc: [10]
exclude:
- gcc: 10
toolchain: chibios-clang

steps:
# git checkout the PR
- uses: actions/checkout@v4
with:
submodules: 'recursive'
# Put ccache into github cache for faster build
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: |
NOW=$(date -u +"%F-%T")
echo "timestamp=${NOW}" >> $GITHUB_OUTPUT
- name: ccache cache files
uses: actions/cache@v4
with:
path: ~/.ccache
key: ${{github.workflow}}-ccache-${{ matrix.toolchain }}-${{ matrix.gcc }}-${{steps.ccache_cache_timestamp.outputs.timestamp}}
restore-keys: ${{github.workflow}}-ccache-${{ matrix.toolchain }}-${{ matrix.gcc }} # restore ccache from either previous build on this branch or on master
- name: setup ccache
run: |
. .github/workflows/ccache.env
- name: build
shell: bash
run: |
git config --global --add safe.directory ${GITHUB_WORKSPACE}
if [[ ${{ matrix.toolchain }} == "chibios-clang" ]]; then
export CC=clang
export CXX=clang++
fi
PATH="/usr/lib/ccache:/opt/gcc-arm-none-eabi-${{matrix.gcc}}/bin:$PATH"
PATH="/github/home/.local/bin:$PATH"
Tools/Carbonix_scripts/carbonix_waf_build.sh
ccache -s
ccache -z
- name: Check build files
id: check_files
uses: andstor/file-existence-action@v2
with:
files: "build/CubeOrange/*, build/CubeOrangePlus/*, build/CubeOrange-Volanti/*, build/CubeOrangePlus-Volanti/*, build/CubeOrange-Ottano/*, build/CubeOrangePlus-Ottano/*, build/CarbonixF405/*, build/CarbonixF405-no-crystal/*"
fail: true
- name: Gather build output
run: |
mkdir -p temp/others
for dir in CubeOrange CubeOrangePlus CubeOrange-Volanti CubeOrangePlus-Volanti CubeOrange-Ottano CubeOrangePlus-Ottano CarbonixF405 CarbonixF405-no-crystal; do
mkdir -p temp/others/$dir/bin
cp -vr build/$dir/bin/* temp/others/$dir/bin/
done
cp -vr output/* temp/
mv temp/others/CubeOrange-Volanti temp/Volanti
mv temp/others/CubeOrangePlus-Volanti temp/Volanti
mv temp/others/CubeOrange-Ottano temp/Ottano
mv temp/others/CubeOrangePlus-Ottano temp/Ottano
if [ -d "ArduPlane/ReleaseNotes.txt" ]; then
cp -v ArduPlane/ReleaseNotes.txt temp/
else
echo "ReleaseNotes.txt File does not exist"
fi
if [ -d "libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/payloads" ]; then
cp -vr libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/payloads temp/
else
echo "payloads Folder does not exist"
fi
shell: sh -e {0}
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: apj
path: temp
retention-days: 90

upload:
runs-on: ubuntu-22.04
needs: [build-apj, build-sitl]
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Extract firmware version, commit id, and branch name
id: extract_info
run: |
FIRMWARE_VERSION=$(grep -oP 'define AP_CUSTOM_FIRMWARE_STRING "\K(.*)(?=")' libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/version.inc)
COMMIT_ID=$(git rev-parse --short HEAD)
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})
echo "firmware_version=$FIRMWARE_VERSION" >> $GITHUB_ENV
echo "commit_id=$COMMIT_ID" >> $GITHUB_ENV
echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV
shell: sh -e {0}

- name: Download APJ build
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: apj
path: temp

- name: Download SITL build
uses: actions/download-artifact@v4
with:
name: sitl
path: temp/sitl

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand All @@ -542,18 +431,8 @@ jobs:
aws-region: us-east-1

- name: Upload artifacts to S3
shell: pwsh
run: |
DATE_HR=$(date +%Y%m%d_%H%M)
if ${{ github.event_name == 'release' }}; then
PATH_TO_S3=s3://carbonix-firmware-release-files/Carbopilot_V2/${DATE_HR}_${{ env.firmware_version }}_${{ env.commit_id }}/
echo "Uploading to: $PATH_TO_S3"
aws s3 cp temp/ $PATH_TO_S3 --recursive
elif ${{ github.event_name == 'push' && startsWith(env.branch_name, 'CxPilot') }}; then
PATH_TO_S3=s3://carbonix-firmware-dev-files/Carbopilot_V2/${{ env.branch_name }}/${DATE_HR}_${{ env.firmware_version }}_${{ env.commit_id }}/
echo "Uploading to: $PATH_TO_S3"
aws s3 cp temp/ $PATH_TO_S3 --recursive
elif ${{ github.event_name == 'pull_request' }}; then
PATH_TO_S3=s3://carbonix-firmware-dev-files/Carbopilot_V2/PR/${DATE_HR}_${{ env.firmware_version }}_${{ env.commit_id }}_${{ github.event.pull_request.number }}/
echo "Uploading to: $PATH_TO_S3"
aws s3 cp temp/ $PATH_TO_S3 --recursive
fi
$env:PATH_TO_S3 = '${{ needs.setup-s3-path.outputs.s3_path }}'
echo "Uploading to: $env:PATH_TO_S3"
aws s3 cp temp/ $env:PATH_TO_S3 --recursive

0 comments on commit f843aa3

Please sign in to comment.