diff --git a/.github/actions/docker-build-and-push/action.yaml b/.github/actions/docker-build-and-push/action.yaml index 4e42577f96b..ea750e6e7c6 100644 --- a/.github/actions/docker-build-and-push/action.yaml +++ b/.github/actions/docker-build-and-push/action.yaml @@ -16,7 +16,7 @@ inputs: required: false allow-push: description: "" - default: "true" + default: "false" required: false runs: @@ -108,8 +108,7 @@ runs: password: ${{ github.token }} - name: Build and Push to GitHub Container Registry - if: ${{ github.event_name == 'push' || - github.event_name == 'schedule' || + if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.artifacts-destination == 'registry') }} uses: docker/bake-action@v5 with: diff --git a/.github/workflows/build-main-self-hosted.yaml b/.github/workflows/build-main-self-hosted.yaml deleted file mode 100644 index a93cc134485..00000000000 --- a/.github/workflows/build-main-self-hosted.yaml +++ /dev/null @@ -1,64 +0,0 @@ -name: build-main-self-hosted - -on: - schedule: - - cron: 0 12 * * * - workflow_dispatch: - -jobs: - load-env: - uses: ./.github/workflows/load-env.yaml - - build-main-self-hosted: - needs: load-env - runs-on: [self-hosted, linux, ARM64] - strategy: - fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 - setup-args: --no-nvidia - additional-tag-suffix: "" - - name: cuda - platform: arm64 - base_image_env: base_image - lib_dir: aarch64 - additional-tag-suffix: -cuda - steps: - # https://github.com/actions/checkout/issues/211 - - name: Change permission of workspace - run: | - sudo chown -R $USER:$USER ${{ github.workspace }} - - - name: Check out repository - uses: actions/checkout@v4 - - - name: Set git config - uses: autowarefoundation/autoware-github-actions/set-git-config@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Free disk space - uses: ./.github/actions/free-disk-space - - - name: Build 'Autoware' - uses: ./.github/actions/docker-build - with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} - cache-tag-suffix: main - build-args: | - ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - SETUP_ARGS=${{ matrix.setup-args }} - LIB_DIR=${{ matrix.lib_dir }} - - - name: Show disk space - run: | - df -h diff --git a/.github/workflows/build-main.yaml b/.github/workflows/build-main.yaml deleted file mode 100644 index 249402092e7..00000000000 --- a/.github/workflows/build-main.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: build-main - -on: - schedule: - - cron: 0 12 * * * - workflow_dispatch: - -jobs: - load-env: - uses: ./.github/workflows/load-env.yaml - - build-main: - needs: load-env - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - name: - - no-cuda - - cuda - include: - - name: no-cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 - setup-args: --no-nvidia - additional-tag-suffix: "" - - name: cuda - platform: amd64 - base_image_env: base_image - lib_dir: x86_64 - additional-tag-suffix: -cuda - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Set git config - uses: autowarefoundation/autoware-github-actions/set-git-config@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Free disk space - uses: ./.github/actions/free-disk-space - - - name: Build 'Autoware' - uses: ./.github/actions/docker-build - with: - name: ${{ matrix.name }} - platform: ${{ matrix.platform }} - cache-tag-suffix: main - build-args: | - ROS_DISTRO=${{ needs.load-env.outputs.rosdistro }} - BASE_IMAGE=${{ needs.load-env.outputs[format('{0}', matrix.base_image_env)] }} - SETUP_ARGS=${{ matrix.setup-args }} - LIB_DIR=${{ matrix.lib_dir }} - - - name: Show disk space - run: | - df -h diff --git a/.github/workflows/docker-build-and-push-main-self-hosted.yaml b/.github/workflows/docker-build-self-hosted.yaml similarity index 88% rename from .github/workflows/docker-build-and-push-main-self-hosted.yaml rename to .github/workflows/docker-build-self-hosted.yaml index 541b2757744..9257de94900 100644 --- a/.github/workflows/docker-build-and-push-main-self-hosted.yaml +++ b/.github/workflows/docker-build-self-hosted.yaml @@ -4,14 +4,14 @@ # push-branch: Build only devel and prebuilt. TAGS: date, latest # push-tag: Build all. TAGS: version, date, latest -name: docker-build-and-push-main-self-hosted +name: docker-build-self-hosted on: push: tags: - openadkit-v*.*.* schedule: - - cron: 0 0 1,15 * * + - cron: 0 12 * * * workflow_dispatch: inputs: artifacts-destination: @@ -26,7 +26,7 @@ jobs: load-env: uses: ./.github/workflows/load-env.yaml - docker-build-and-push-main-self-hosted: + docker-build-self-hosted: needs: load-env runs-on: [self-hosted, linux, ARM64] strategy: @@ -48,6 +48,12 @@ jobs: lib_dir: aarch64 additional-tag-suffix: -cuda steps: + - name: Check if push day + if: ${{ github.event_name == 'schedule' }} + run: | + if [ $(date +'%d') -eq 01 ] || [ $(date +'%d') -eq 15 ]; then echo "IS_PUSH_DAY=true" >> $GITHUB_ENV; else echo "IS_PUSH_DAY=false" >> $GITHUB_ENV; fi + echo "Day of the month: $(date +'%d')" + # https://github.com/actions/checkout/issues/211 - name: Change permission of workspace run: | @@ -101,7 +107,7 @@ jobs: *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.ref_name }},mode=max tag-suffix: ${{ matrix.additional-tag-suffix }}-${{ matrix.platform }} tag-prefix: ${{ needs.load-env.outputs.rosdistro }} - allow-push: true + allow-push: ${{ env.IS_PUSH_DAY == 'true' }} - name: Show disk space run: | diff --git a/.github/workflows/docker-build-and-push-main.yaml b/.github/workflows/docker-build.yaml similarity index 88% rename from .github/workflows/docker-build-and-push-main.yaml rename to .github/workflows/docker-build.yaml index 32193ef6dc1..e9bfc4f70c9 100644 --- a/.github/workflows/docker-build-and-push-main.yaml +++ b/.github/workflows/docker-build.yaml @@ -4,14 +4,14 @@ # push-branch: Build only devel and prebuilt. TAGS: date, latest # push-tag: Build all. TAGS: version, date, latest -name: docker-build-and-push-main +name: docker-build on: push: tags: - openadkit-v*.*.* schedule: - - cron: 0 0 1,15 * * + - cron: 0 12 * * * workflow_dispatch: inputs: artifacts-destination: @@ -26,7 +26,7 @@ jobs: load-env: uses: ./.github/workflows/load-env.yaml - docker-build-and-push-main: + docker-build: needs: load-env runs-on: ubuntu-latest strategy: @@ -48,6 +48,12 @@ jobs: lib_dir: x86_64 additional-tag-suffix: -cuda steps: + - name: Check if push day + if: ${{ github.event_name == 'schedule' }} + run: | + if [ $(date +'%d') -eq 01 ] || [ $(date +'%d') -eq 15 ]; then echo "IS_PUSH_DAY=true" >> $GITHUB_ENV; else echo "IS_PUSH_DAY=false" >> $GITHUB_ENV; fi + echo "Day of the month: $(date +'%d')" + - name: Check out repository uses: actions/checkout@v4 @@ -96,7 +102,7 @@ jobs: *.cache-to=type=registry,ref=ghcr.io/${{ github.repository }}-buildcache:${{ matrix.name }}-${{ matrix.platform }}-${{ github.ref_name }},mode=max tag-suffix: ${{ matrix.additional-tag-suffix }}-${{ matrix.platform }} tag-prefix: ${{ needs.load-env.outputs.rosdistro }} - allow-push: true + allow-push: ${{ env.IS_PUSH_DAY == 'true' }} - name: Show disk space run: | diff --git a/README.md b/README.md index cbc8e85a0f3..6e45987d48d 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@

- - + Build Main CI