Weekly clean & rebuild #117
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: Weekly clean & rebuild | |
on: | |
schedule: | |
- cron: '0 8 * * 6' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build system image without using cache | |
runs-on: | |
labels: dts-builder | |
steps: | |
- name: Prepare SSH key | |
shell: bash | |
env: | |
SSH_KEY: ${{secrets.SSH_KEY}} | |
run: | | |
echo -e ${SSH_KEY} > ~/.ssh/dts-ci-key | |
chmod 600 ~/.ssh/dts-ci-key | |
- name: Checkout meta-dts repo | |
uses: actions/checkout@v2 | |
with: | |
path: "meta-dts" | |
- name: Prepare cache-less build configuration | |
shell: bash | |
run: | | |
sed -i '/cache.yml/d' meta-dts/kas.yml | |
- name: Build DTS image | |
shell: bash | |
id: build_image | |
run: | | |
for attempt in {1..5}; do | |
if kas-container build meta-dts/kas.yml; then | |
echo "Build command succeeded on attempt $attempt" | |
break | |
else | |
echo "Build command failed on attempt $attempt" | |
if [ $attempt -lt 5 ]; then | |
sleep 5 | |
fi | |
fi | |
done | |
continue-on-error: true | |
- name: Report build command | |
run: | | |
if [ ${{ steps.build_image.outcome }} == 'failure' ]; then | |
echo "All build attempts failed." | |
exit 1 | |
else | |
echo "At least one build attempt succeeded." | |
fi | |
deploy-cache: | |
name: Deploy cache on cache.dasharo.com | |
if: always() | |
needs: build | |
runs-on: | |
labels: dts-builder | |
steps: | |
- name: Prepare SSH key | |
shell: bash | |
env: | |
SSH_KEY: ${{secrets.SSH_KEY}} | |
run: | | |
echo -e ${SSH_KEY} > ~/.ssh/dts-ci-key | |
chmod 600 ~/.ssh/dts-ci-key | |
- name: Send sstate-cache folder to cache.dasharo.com | |
shell: bash | |
run: | | |
ssh -i ~/.ssh/dts-ci-key [email protected] "mkdir -p cache/yocto/dts" | |
rsync -P -e "ssh -i ~/.ssh/dts-ci-key" -rlptD --delete build/sstate-cache [email protected]:cache/yocto/dts | |
- name: Send downloads folder to cache.dasharo.com | |
shell: bash | |
run: | | |
rsync -P -e "ssh -i ~/.ssh/dts-ci-key" -rlptD --delete build/downloads [email protected]:cache/yocto/dts | |
cleanup: | |
name: Cleanup | |
if: always() | |
needs: deploy-cache | |
runs-on: | |
labels: dts-builder | |
steps: | |
- name: Cleanup after deployment | |
shell: bash | |
run: | | |
rm -rf ~/.ssh/dts-ci-key | |
rm -rf build |