From 5451f1023f822b48d9830aa1efc8db86aaaf382a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Fri, 7 Jun 2024 12:18:20 +0300 Subject: [PATCH] ci(build-and-test): extract the action and simplify MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt run on pr for testing Signed-off-by: M. Fatih Cırıt on push main Signed-off-by: M. Fatih Cırıt check out Signed-off-by: M. Fatih Cırıt rem check out from action Signed-off-by: M. Fatih Cırıt style(pre-commit): autofix fix action name Signed-off-by: M. Fatih Cırıt shell Signed-off-by: M. Fatih Cırıt fix container Signed-off-by: M. Fatih Cırıt fix machine type Signed-off-by: M. Fatih Cırıt remove quotes and update the name Signed-off-by: M. Fatih Cırıt --- .github/actions/build-and-test/action.yaml | 53 +++++++++++++++ .github/workflows/build-and-test-arm64.yaml | 55 --------------- .github/workflows/build-and-test-cuda.yaml | 33 +++++++++ .../workflows/build-and-test-daily-arm64.yaml | 34 ++++++++++ .github/workflows/build-and-test-daily.yaml | 34 ++++++++++ .github/workflows/build-and-test.yaml | 67 ------------------- 6 files changed, 154 insertions(+), 122 deletions(-) create mode 100644 .github/actions/build-and-test/action.yaml delete mode 100644 .github/workflows/build-and-test-arm64.yaml create mode 100644 .github/workflows/build-and-test-cuda.yaml create mode 100644 .github/workflows/build-and-test-daily-arm64.yaml create mode 100644 .github/workflows/build-and-test-daily.yaml delete mode 100644 .github/workflows/build-and-test.yaml diff --git a/.github/actions/build-and-test/action.yaml b/.github/actions/build-and-test/action.yaml new file mode 100644 index 0000000000000..5f77209da960c --- /dev/null +++ b/.github/actions/build-and-test/action.yaml @@ -0,0 +1,53 @@ +name: build-and-test +description: Reusable action for building and testing the repository +inputs: + build-depends-repos: + description: Repositories for build dependencies + required: true + rosdistro: + description: ROS distribution + required: true + +runs: + using: composite + steps: + - name: Show disk space before the tasks + shell: bash + run: df -h + + - name: Remove exec_depend + uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1 + + - name: Get self packages + id: get-self-packages + uses: autowarefoundation/autoware-github-actions/get-self-packages@v1 + + - name: Build + if: ${{ steps.get-self-packages.outputs.self-packages != '' }} + uses: autowarefoundation/autoware-github-actions/colcon-build@v1 + with: + rosdistro: ${{ inputs.rosdistro }} + target-packages: ${{ steps.get-self-packages.outputs.self-packages }} + build-depends-repos: ${{ inputs.build-depends-repos }} + + - name: Test + if: ${{ steps.get-self-packages.outputs.self-packages != '' }} + id: test + uses: autowarefoundation/autoware-github-actions/colcon-test@v1 + with: + rosdistro: ${{ inputs.rosdistro }} + target-packages: ${{ steps.get-self-packages.outputs.self-packages }} + build-depends-repos: ${{ inputs.build-depends-repos }} + + - name: Upload coverage to CodeCov + if: ${{ steps.test.outputs.coverage-report-files != '' }} + uses: codecov/codecov-action@v3 + with: + files: ${{ steps.test.outputs.coverage-report-files }} + fail_ci_if_error: false + verbose: true + flags: total + + - name: Show disk space after the tasks + shell: bash + run: df -h diff --git a/.github/workflows/build-and-test-arm64.yaml b/.github/workflows/build-and-test-arm64.yaml deleted file mode 100644 index c9a4b46874e18..0000000000000 --- a/.github/workflows/build-and-test-arm64.yaml +++ /dev/null @@ -1,55 +0,0 @@ -name: build-and-test-arm64 - -on: - schedule: - - cron: 0 0 * * * - workflow_dispatch: - -jobs: - build-and-test-arm64: - runs-on: [self-hosted, linux, ARM64] - container: ${{ matrix.container }}${{ matrix.container-suffix }} - strategy: - fail-fast: false - matrix: - rosdistro: - - humble - container-suffix: - - "" - - -cuda - include: - - rosdistro: humble - container: ghcr.io/autowarefoundation/autoware:latest-prebuilt - build-depends-repos: build_depends.repos - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Show disk space before the tasks - run: df -h - - - name: Remove exec_depend - uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1 - - - name: Get self packages - id: get-self-packages - uses: autowarefoundation/autoware-github-actions/get-self-packages@v1 - - - name: Build - if: ${{ steps.get-self-packages.outputs.self-packages != '' }} - uses: autowarefoundation/autoware-github-actions/colcon-build@v1 - with: - rosdistro: ${{ matrix.rosdistro }} - target-packages: ${{ steps.get-self-packages.outputs.self-packages }} - build-depends-repos: ${{ matrix.build-depends-repos }} - - - name: Test - if: ${{ steps.get-self-packages.outputs.self-packages != '' }} - uses: autowarefoundation/autoware-github-actions/colcon-test@v1 - with: - rosdistro: ${{ matrix.rosdistro }} - target-packages: ${{ steps.get-self-packages.outputs.self-packages }} - build-depends-repos: ${{ matrix.build-depends-repos }} - - - name: Show disk space after the tasks - run: df -h diff --git a/.github/workflows/build-and-test-cuda.yaml b/.github/workflows/build-and-test-cuda.yaml new file mode 100644 index 0000000000000..8fe34b3ced52a --- /dev/null +++ b/.github/workflows/build-and-test-cuda.yaml @@ -0,0 +1,33 @@ +name: build-and-test-cuda + +on: + pull_request: + types: [opened, labeled, unlabeled, synchronize] + push: + branches: + - main + +jobs: + build-and-test-cuda: + runs-on: [self-hosted, linux, X64] + container: ${{ matrix.container }}${{ matrix.container-suffix }} + strategy: + fail-fast: false + matrix: + rosdistro: + - humble + container-suffix: + - -cuda + include: + - rosdistro: humble + container: ghcr.io/autowarefoundation/autoware:latest-prebuilt + build-depends-repos: build_depends.repos + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Build and Test + uses: ./.github/actions/build-and-test + with: + build-depends-repos: ${{ matrix.build-depends-repos }} + rosdistro: ${{ matrix.rosdistro }} diff --git a/.github/workflows/build-and-test-daily-arm64.yaml b/.github/workflows/build-and-test-daily-arm64.yaml new file mode 100644 index 0000000000000..e60e148ae3814 --- /dev/null +++ b/.github/workflows/build-and-test-daily-arm64.yaml @@ -0,0 +1,34 @@ +name: build-and-test-daily-arm64 + +on: + pull_request: + types: [opened, labeled, unlabeled, synchronize] + schedule: + - cron: 0 0 * * * + workflow_dispatch: + +jobs: + build-and-test-daily-arm64: + runs-on: [self-hosted, linux, ARM64] + container: ${{ matrix.container }}${{ matrix.container-suffix }} + strategy: + fail-fast: false + matrix: + rosdistro: + - humble + container-suffix: + - "" + - -cuda + include: + - rosdistro: humble + container: ghcr.io/autowarefoundation/autoware:latest-prebuilt + build-depends-repos: build_depends.repos + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Build and Test + uses: ./.github/actions/build-and-test + with: + build-depends-repos: ${{ matrix.build-depends-repos }} + rosdistro: ${{ matrix.rosdistro }} diff --git a/.github/workflows/build-and-test-daily.yaml b/.github/workflows/build-and-test-daily.yaml new file mode 100644 index 0000000000000..136368f5bee13 --- /dev/null +++ b/.github/workflows/build-and-test-daily.yaml @@ -0,0 +1,34 @@ +name: build-and-test-daily + +on: + pull_request: + types: [opened, labeled, unlabeled, synchronize] + schedule: + - cron: 0 0 * * * + workflow_dispatch: + +jobs: + build-and-test-daily: + runs-on: [self-hosted, linux, X64] + container: ${{ matrix.container }}${{ matrix.container-suffix }} + strategy: + fail-fast: false + matrix: + rosdistro: + - humble + container-suffix: + - "" + - -cuda + include: + - rosdistro: humble + container: ghcr.io/autowarefoundation/autoware:latest-prebuilt + build-depends-repos: build_depends.repos + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Build and Test + uses: ./.github/actions/build-and-test + with: + build-depends-repos: ${{ matrix.build-depends-repos }} + rosdistro: ${{ matrix.rosdistro }} diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml deleted file mode 100644 index 85c531a02fca9..0000000000000 --- a/.github/workflows/build-and-test.yaml +++ /dev/null @@ -1,67 +0,0 @@ -name: build-and-test - -on: - push: - schedule: - - cron: 0 0 * * * - workflow_dispatch: - -jobs: - build-and-test: - if: ${{ github.event_name != 'push' || github.ref_name == github.event.repository.default_branch }} - runs-on: [self-hosted, linux, X64] - container: ${{ matrix.container }}${{ matrix.container-suffix }} - strategy: - fail-fast: false - matrix: - rosdistro: - - humble - container-suffix: - - "" - - -cuda - include: - - rosdistro: humble - container: ghcr.io/autowarefoundation/autoware:latest-prebuilt - build-depends-repos: build_depends.repos - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Show disk space before the tasks - run: df -h - - - name: Remove exec_depend - uses: autowarefoundation/autoware-github-actions/remove-exec-depend@v1 - - - name: Get self packages - id: get-self-packages - uses: autowarefoundation/autoware-github-actions/get-self-packages@v1 - - - name: Build - if: ${{ steps.get-self-packages.outputs.self-packages != '' }} - uses: autowarefoundation/autoware-github-actions/colcon-build@v1 - with: - rosdistro: ${{ matrix.rosdistro }} - target-packages: ${{ steps.get-self-packages.outputs.self-packages }} - build-depends-repos: ${{ matrix.build-depends-repos }} - - - name: Test - if: ${{ steps.get-self-packages.outputs.self-packages != '' }} - id: test - uses: autowarefoundation/autoware-github-actions/colcon-test@v1 - with: - rosdistro: ${{ matrix.rosdistro }} - target-packages: ${{ steps.get-self-packages.outputs.self-packages }} - build-depends-repos: ${{ matrix.build-depends-repos }} - - - name: Upload coverage to CodeCov - if: ${{ steps.test.outputs.coverage-report-files != '' }} - uses: codecov/codecov-action@v3 - with: - files: ${{ steps.test.outputs.coverage-report-files }} - fail_ci_if_error: false - verbose: true - flags: total - - - name: Show disk space after the tasks - run: df -h