diff --git a/.github/workflows/cleanup-autoware-new.yaml b/.github/workflows/cleanup-autoware-new.yaml new file mode 100644 index 0000000000..74d4a29100 --- /dev/null +++ b/.github/workflows/cleanup-autoware-new.yaml @@ -0,0 +1,34 @@ +name: cleanup-autoware-new + +on: + workflow_dispatch: + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - name: Delete all autoware-new package versions + env: + GITHUB_TOKEN: ${{ github.token }} + OWNER: ${{ github.repository_owner }} + PACKAGE: autoware-new + run: | + for page in $(seq 1 20); do + versions=$(curl -fsSL \ + "https://api.github.com/users/${OWNER}/packages/container/${PACKAGE}/versions?per_page=100&page=${page}" \ + -H "Authorization: token ${GITHUB_TOKEN}" \ + | jq -r '.[].id') + + if [ -z "$versions" ]; then + echo "No more versions found." + break + fi + + for id in $versions; do + echo "Deleting version ${id}" + curl -X DELETE \ + -H "Authorization: Bearer ${GITHUB_TOKEN}" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/users/${OWNER}/packages/container/${PACKAGE}/versions/${id}" || true + done + done diff --git a/.github/workflows/health-check-new.yaml b/.github/workflows/health-check-new.yaml new file mode 100644 index 0000000000..e76a74ea18 --- /dev/null +++ b/.github/workflows/health-check-new.yaml @@ -0,0 +1,174 @@ +name: health-check-new + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - labeled + schedule: + - cron: 0 12 * * * + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + label-check: + uses: autowarefoundation/autoware-github-actions/.github/workflows/make-sure-label-is-present.yaml@v1 + with: + label: run:health-check-new + + docker-build: + needs: label-check + if: ${{ needs.label-check.outputs.result == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' }} + strategy: + fail-fast: false + matrix: + build-type: [main, nightly, main-arm64] + include: + - build-type: main + platform: amd64 + runner: "['self-hosted','Linux','X64']" + - build-type: nightly + platform: amd64 + runner: "['ubuntu-24.04']" + - build-type: main-arm64 + platform: arm64 + runner: "['ubuntu-24.04-arm']" + runs-on: ${{ fromJson(matrix.runner) }} + steps: + - name: ๐Ÿ”ง Change permission of workspace + run: | + sudo rm -rf ${{ github.workspace }}/scenario_out + sudo chown -R $USER:$USER ${{ github.workspace }} + + - name: ๐Ÿ“ฅ Check out repository + uses: actions/checkout@v6 + + - name: ๐Ÿ“‚ Get changed files + id: changed-files + uses: step-security/changed-files@v47 + with: + files: | + repositories/*.repos + .github/workflows/health-check-new.yaml + ansible-galaxy-requirements.yaml + ansible/** + docker-new/** + + - name: ๐Ÿ’ป Runner specs + run: | + echo "::group::CPU" + lscpu | grep -E "^(Architecture|CPU\(s\)|Model name|Thread|Core|Socket)" + echo "::endgroup::" + echo "::group::Memory" + free -h + echo "::endgroup::" + echo "::group::Disk" + df -h / + echo "::endgroup::" + + - name: ๐Ÿงน Free disk space + if: ${{ matrix.build-type != 'main' && + (steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch') }} + uses: ./.github/actions/free-disk-space + + - name: ๐Ÿ’พ Create additional swap + if: ${{ matrix.platform == 'arm64' && + (steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch') }} + run: | + sudo fallocate -l 8G /mnt/swapfile + sudo chmod 600 /mnt/swapfile + sudo mkswap /mnt/swapfile + sudo swapon /mnt/swapfile + free -h + + - name: ๐Ÿ“ฆ Import source repos + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' }} + run: | + pipx install vcs2l + mkdir -p src + vcs import --shallow src < repositories/autoware.repos + + - name: ๐Ÿ“ฆ Overlay nightly repos + if: ${{ matrix.build-type == 'nightly' && + (steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch') }} + run: | + vcs import --shallow --force src < repositories/autoware-nightly.repos + + - name: ๐Ÿณ Setup Docker Buildx + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' }} + uses: docker/setup-buildx-action@v4 + with: + buildkitd-config-inline: | + [worker.oci] + max-parallelism = 2 + + - name: ๐Ÿ”‘ Login to GitHub Container Registry + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' }} + uses: docker/login-action@v4 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ github.token }} + + - name: ๐Ÿ”จ Build Autoware (docker-new) + if: ${{ steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' }} + uses: docker/bake-action@v7 + env: + ROS_DISTRO: humble + with: + source: . + targets: universe-devel + files: docker-new/docker-bake.hcl + load: true + provenance: false + set: | + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache-new:${{ matrix.platform }}-main + *.cache-from=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache-new:${{ matrix.build-type }}-${{ matrix.platform }}-main + + - name: ๐Ÿ’พ Save Docker image + if: ${{ matrix.build-type == 'main' && + (steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch') }} + run: docker save autoware:universe-devel-humble | gzip > /tmp/autoware-image.tar.gz + + - name: ๐Ÿ“ค Upload Docker image artifact + if: ${{ matrix.build-type == 'main' && + (steps.changed-files.outputs.any_changed == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch') }} + uses: actions/upload-artifact@v7 + with: + name: autoware-image + path: /tmp/autoware-image.tar.gz + + - name: ๐Ÿ“Š Disk space + if: always() + run: df -h + + scenario-test: + needs: docker-build + uses: ./.github/workflows/scenario-test-reusable.yaml + with: + autoware_container_image: autoware:universe-devel-humble