diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index e5f8cf6955d..757c7c3cead 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -14,6 +14,10 @@ inputs: tag-suffix: description: "" required: false + allow-push: + description: "" + default: "true" + required: false runs: using: composite @@ -87,7 +91,7 @@ runs: uses: docker/bake-action@v3 with: # Checking event_name for https://github.com/autowarefoundation/autoware/issues/2796 - push: ${{ github.event_name == 'schedule' || github.ref_name == github.event.repository.default_branch || github.event_name == 'push'}} + push: ${{ (github.event_name == 'schedule' || github.ref_name == github.event.repository.default_branch || github.event_name == 'push') && inputs.allow-push == 'true' }} files: | docker/${{ inputs.bake-target }}/docker-bake.hcl ${{ steps.meta-devel.outputs.bake-file }} diff --git a/.github/actions/free-disk-space/action.yaml b/.github/actions/free-disk-space/action.yaml index 04b0e85235d..963b656313f 100644 --- a/.github/actions/free-disk-space/action.yaml +++ b/.github/actions/free-disk-space/action.yaml @@ -12,25 +12,18 @@ runs: fi shell: bash - # https://github.community/t/bug-strange-no-space-left-on-device-ioexceptions-on-github-runners/17616 - - name: Free disk space - run: | - df -h - - sudo apt-get -y purge \ - dotnet* \ - ghc* \ - php* \ - || true - sudo apt-get -y autoremove - sudo apt-get -y autoclean - - sudo rm -rf \ - /usr/local/lib/android \ - /usr/share/dotnet/ \ - /opt/ghc + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: true - docker rmi $(docker image ls -aq) || true - - df -h - shell: bash + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: false diff --git a/.github/workflows/build-main-self-hosted.yaml b/.github/workflows/build-main-self-hosted.yaml index 02dd6472811..8f51ba5a262 100644 --- a/.github/workflows/build-main-self-hosted.yaml +++ b/.github/workflows/build-main-self-hosted.yaml @@ -6,42 +6,56 @@ on: workflow_dispatch: jobs: - load-env: - uses: ./.github/workflows/load-env.yaml - build-main-self-hosted: - needs: load-env runs-on: [self-hosted, linux, ARM64] - container: ${{ needs.load-env.outputs.base-image }} + strategy: + fail-fast: false + matrix: + name: + - no-cuda + - cuda + include: + - name: no-cuda + base_image_env: base_image + setup-args: --no-nvidia + additional-tag-suffix: "" + - name: cuda + base_image_env: cuda_base_image + setup-args: --no-cuda-drivers + additional-tag-suffix: -cuda steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Run setup script + # https://github.com/actions/checkout/issues/211 + - name: Change permission of workspace run: | - ./setup-dev-env.sh -y - - - name: Set git config - uses: autowarefoundation/autoware-github-actions/set-git-config@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} + sudo chown -R $USER:$USER ${{ github.workspace }} - - name: Run vcs import - run: | - mkdir src - vcs import src < autoware.repos + - name: Check out repository + uses: actions/checkout@v4 - - name: Run vcs export - run: | - vcs export --exact src || true + - name: Free disk space + uses: ./.github/actions/free-disk-space - - name: Run rosdep install + - name: Load env run: | - sudo apt-get -y update - rosdep update - DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths src --ignore-src --rosdistro ${{ needs.load-env.outputs.rosdistro }} + cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV + if [ "$(uname -m)" = "aarch64" ]; then + cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV + fi - - name: Build + - name: Build 'autoware-universe' + uses: ./.github/actions/docker-build-and-push + with: + bake-target: autoware-universe + build-args: | + *.platform=linux/arm64 + *.args.ROS_DISTRO=${{ env.rosdistro }} + *.args.BASE_IMAGE=${{ env[format('{0}', matrix.base_image_env)] }} + *.args.PREBUILT_BASE_IMAGE=${{ env.prebuilt_base_image }} + *.args.SETUP_ARGS=${{ matrix.setup-args }} + tag-prefix: ${{ env.rosdistro }}- + tag-suffix: ${{ matrix.additional-tag-suffix }}-arm64 + allow-push: false + + - name: Show disk space run: | - . /opt/ros/${{ needs.load-env.outputs.rosdistro }}/setup.sh - colcon build --event-handlers console_cohesion+ --cmake-args -DCMAKE_BUILD_TYPE=Release + df -h diff --git a/.github/workflows/build-main.yaml b/.github/workflows/build-main.yaml index 45cb811ae17..0b55e94658e 100644 --- a/.github/workflows/build-main.yaml +++ b/.github/workflows/build-main.yaml @@ -6,42 +6,51 @@ on: workflow_dispatch: jobs: - load-env: - uses: ./.github/workflows/load-env.yaml - build-main: - needs: load-env runs-on: ubuntu-latest - container: ${{ needs.load-env.outputs.base-image }} + strategy: + fail-fast: false + matrix: + name: + - no-cuda + - cuda + include: + - name: no-cuda + base_image_env: base_image + setup-args: --no-nvidia + additional-tag-suffix: "" + - name: cuda + base_image_env: cuda_base_image + setup-args: --no-cuda-drivers + additional-tag-suffix: -cuda steps: - name: Check out repository uses: actions/checkout@v4 - - name: Run setup script - run: | - ./setup-dev-env.sh -y + - name: Free disk space + uses: ./.github/actions/free-disk-space - - name: Set git config - uses: autowarefoundation/autoware-github-actions/set-git-config@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Run vcs import + - name: Load env run: | - mkdir src - vcs import src < autoware.repos + cat amd64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV + if [ "$(uname -m)" = "aarch64" ]; then + cat arm64.env | sed -e "s/^\s*//" -e "/^#/d" >> $GITHUB_ENV + fi - - name: Run vcs export - run: | - vcs export --exact src || true - - - name: Run rosdep install - run: | - sudo apt-get -y update - rosdep update - DEBIAN_FRONTEND=noninteractive rosdep install -y --from-paths src --ignore-src --rosdistro ${{ needs.load-env.outputs.rosdistro }} - - - name: Build + - name: Build 'autoware-universe' + uses: ./.github/actions/docker-build-and-push + with: + bake-target: autoware-universe + build-args: | + *.platform=linux/amd64 + *.args.ROS_DISTRO=${{ env.rosdistro }} + *.args.BASE_IMAGE=${{ env[format('{0}', matrix.base_image_env)] }} + *.args.PREBUILT_BASE_IMAGE=${{ env.prebuilt_base_image }} + *.args.SETUP_ARGS=${{ matrix.setup-args }} + tag-prefix: ${{ env.rosdistro }}- + tag-suffix: ${{ matrix.additional-tag-suffix }}-amd64 + allow-push: false + + - name: Show disk space run: | - . /opt/ros/${{ needs.load-env.outputs.rosdistro }}/setup.sh - colcon build --event-handlers console_cohesion+ --cmake-args -DCMAKE_BUILD_TYPE=Release + df -h