Images Fetch #37
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: Images Fetch | |
# This workflow represents a specific configuration for a | |
# single MACHINE as a specific design goal. It utilizes a | |
# reusable workflow found at distro-core/distro-manifest. | |
# Variables and Actions | |
# secrets.AWS_ACCESS_KEY_ID Organization, S3 Access Key | |
# secrets.AWS_SECRET_ACCESS_KEY Organization, S3 Secret Key | |
# secrets.AWS_ENDPOINT_URL Organization, S3 Endpoint Hostname | |
# vars.DISTRO Organization, Build DISTRO | |
# vars.DISTRO_CODENAME Organization, Build DISTRO_CODENAME | |
# vars.MACHINE Repository, Build MACHINE | |
# vars.TARGETS Organization, Build TARGETS | |
# Self hosted runners have the prerequsite dependency to | |
# install the host tools dependencies before workflow use. | |
on: | |
# schedule: | |
# - cron: '00 6 * * *' | |
push: | |
branches: | |
- 'release/**' | |
- 'development/**' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ !contains(github.ref, 'release/') }} | |
# workflow permissions for current repository | |
permissions: | |
actions: write | |
attestations: write | |
contents: write | |
id-token: write | |
######################################################################## | |
jobs: | |
workflow: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 360 | |
steps: | |
# setup runner. | |
- id: runner | |
if: ${{ vars.DISTRO != '' && vars.MACHINE != '' }} | |
uses: distro-core/distro-core-action-runner@main | |
# with: | |
# MNT_DEPLOY_DIR: /mnt/artifacts | |
# MNT_DL_DIR: /mnt/downloads | |
# MNT_SSTATE_DIR: /mnt/sstate-cache | |
# keep-alive prevents the workflow from being disabled due to any | |
# github repository inactivity. | |
- id: keepalive | |
uses: liskin/[email protected] | |
# checkout copy of repo to prepare for workflow automation. | |
- id: checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }} | |
- id: gh-cli | |
if: ${{ steps.runner.outputs.runner-environment == 'github-hosted' }} | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} | |
run: | | |
: gh cli | |
gh run list --json databaseId -q '.[].databaseId' -w codeql --limit 500 | | |
xargs -IID -P 15 gh api \ | |
"repos/$(gh repo view --json nameWithOwner -q .nameWithOwner)/actions/runs/ID" \ | |
-X DELETE | |
# contexts reports in the summary log contents of contexts. | |
- id: context | |
uses: distro-core/distro-core-action-context@main | |
# remove the workspace contents; self-hosted runners retain the | |
# workspace artifacts between workflow executions. | |
- id: pre-cleanup | |
uses: distro-core/distro-core-action-cleanup@main | |
with: | |
paths: | | |
build/${{ vars.DISTRO }}/*.{log,lock,sock} | |
build/${{ vars.DISTRO }}/conf/{.*,*} | |
build/${{ vars.DISTRO }} | |
# repo init, sync and manifest; the job creates the workspace | |
# contents and the .repo directory that are referenced in later. | |
- id: repo-local-manifest | |
shell: bash | |
run: | | |
: repo-local-manifests | |
install -d .repo/local_manifests | |
cat <<EOF >.repo/local_manifests/local_manifest.xml | |
<?xml version="1.0" encoding="UTF-8"?> | |
<manifest> | |
<!-- <extend-project name="meta-tegra" revision="scarthgap-l4t-r35.x" upstream="scarthgap-l4t-r35.x" dest-branch="scarthgap-l4t-r35.x"/> --> | |
</manifest> | |
EOF | |
- uses: distro-core/distro-core-action-repo@main | |
with: | |
MANIFEST_URL: https://github.com/distro-core/distro-manifest.git | |
MANIFEST_NAME: distro-head-${{ vars.DISTRO_CODENAME }}.xml | |
MANIFEST_REF: main | |
# build steps to create artifacts. | |
- id: bitbake-targets | |
uses: distro-core/distro-core-action-bitbake@main | |
with: | |
DISTRO: ${{ vars.DISTRO }} | |
MACHINE: ${{ vars.MACHINE }} | |
TARGETS: ${{ vars.TARGETS }} | |
TARGET_FLAGS: --runall=fetch | |
# - uses: actions/cache/save@v4 | |
# with: | |
# key: ${{ runner.os }}-downloads | |
# path: | | |
# build/downloads/* | |
# !build/downloads/git2 | |
# - uses: actions/cache/save@v4 | |
# with: | |
# key: ${{ runner.os }}-sstate-cache | |
# path: | | |
# build/sstate-cache/* | |
# sync shared artifacts to local storage | |
- if: ${{ steps.runner.outputs.runner-environment == 'self-hosted' && steps.bitbake-targets.outputs.dl_dir != '' && steps.runner.outputs.mnt_dl_dir != '' }} | |
uses: distro-core/distro-core-action-rsync@main | |
with: | |
src_dir: ${{ steps.bitbake-targets.outputs.dl_dir }} | |
dst_dir: ${{ steps.runner.outputs.mnt_dl_dir }} | |
- if: ${{ steps.runner.outputs.runner-environment == 'self-hosted' && steps.bitbake-targets.outputs.sstate_dir != '' && steps.runner.outputs.mnt_sstate_dir != '' }} | |
uses: distro-core/distro-core-action-rsync@main | |
with: | |
src_dir: ${{ steps.bitbake-targets.outputs.sstate_dir }} | |
dst_dir: ${{ steps.runner.outputs.mnt_sstate_dir }} | |
# sync artifacts to S3 storage. | |
- uses: distro-core/distro-core-action-s3sync@main | |
with: | |
src_dir: ${{ steps.bitbake-targets.outputs.dl_dir }} | |
dst_dir: s3://distro-core-downloads | |
AWS_ENDPOINT_URL: ${{ secrets.AWS_ENDPOINT_URL }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- uses: distro-core/distro-core-action-s3sync@main | |
with: | |
src_dir: ${{ steps.bitbake-targets.outputs.sstate_dir }} | |
dst_dir: s3://distro-core-sstate-cache | |
AWS_ENDPOINT_URL: ${{ secrets.AWS_ENDPOINT_URL }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
# remove the workspace contents; self-hosted runners retain the | |
# workspace artifacts between workflow executions. | |
- id: post-cleanup | |
uses: distro-core/distro-core-action-cleanup@main | |
with: | |
paths: | | |
build/${{ vars.DISTRO }}/*.{log,lock,sock} | |
build/${{ vars.DISTRO }}/conf/{.*,*} | |
build/${{ vars.DISTRO }} |