From 35f8257eee1374e22706141613708b566df46d7f Mon Sep 17 00:00:00 2001 From: Kibae Shin Date: Sun, 17 Mar 2024 23:38:28 +0900 Subject: [PATCH 1/2] ci: optimize pipeline --- .github/workflows/cmake-linux.yml | 63 +++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/.github/workflows/cmake-linux.yml b/.github/workflows/cmake-linux.yml index 833bcff..c8afadf 100644 --- a/.github/workflows/cmake-linux.yml +++ b/.github/workflows/cmake-linux.yml @@ -8,8 +8,71 @@ on: branches: [ "*" ] jobs: + prepare-asset: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + lfs: false + + - name: Cache test fixtures + id: cache-test-fixtures + uses: actions/cache@v4 + with: + path: test/fixture + key: test-fixtures-v1 + + - name: Download assets(models) + if: steps.cache-test-fixtures.outputs.cache-hit != 'true' + shell: bash + run: | + ./test/fixture/download-test-fixtures.sh + + prepare-apt: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + name: [ Ubuntu-20, Ubuntu-22, Debian-11, Debian-12 ] + build_type: [ Debug ] + include: + - name: Ubuntu-20 + image: "ubuntu:20.04" + - name: Ubuntu-22 + image: "ubuntu:22.04" + - name: Debian-11 + image: "debian:11" + - name: Debian-12 + image: "debian:12" + + steps: + - uses: actions/checkout@v4 + with: + lfs: false + + - name: Cache dependencies(apt) + id: cache-dependencies-apt + uses: actions/cache@v4 + with: + path: .github/cache/dependencies-apt + key: ${{ matrix.image }}-dependencies-apt-v1 + + - name: Prepare container(apt download) + shell: bash + if: steps.cache-dependencies-apt.outputs.cache-hit != 'true' && (startsWith(matrix.image, 'debian:') || startsWith(matrix.image, 'ubuntu:')) + run: | + sudo apt-get update -qq + sudo apt-get install -yq --download-only build-essential clang-11 cmake libboost-all-dev libssl-dev libgtest-dev + cp /var/cache/apt/archives/*.deb .github/cache/dependencies-apt/ + + + + build: runs-on: ubuntu-latest + needs: ["prepare-asset", "prepare-apt"] strategy: fail-fast: false From b9c02b7cd868037e8fbdb65fa7ba23677c796ca5 Mon Sep 17 00:00:00 2001 From: Kibae Shin Date: Sun, 17 Mar 2024 23:42:27 +0900 Subject: [PATCH 2/2] ci: optimize pipeline --- .github/workflows/asset-cache.yml | 69 ------------------------------- .github/workflows/cmake-linux.yml | 26 ++++++------ .github/workflows/cmake-macos.yml | 26 ++++++------ 3 files changed, 26 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/asset-cache.yml diff --git a/.github/workflows/asset-cache.yml b/.github/workflows/asset-cache.yml deleted file mode 100644 index 79e1c9a..0000000 --- a/.github/workflows/asset-cache.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: Asset Cache - -on: - push: - branches: [ "*" ] - pull_request: - branches: [ "*" ] - -jobs: - apt-download: - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - name: [ Ubuntu-20, Ubuntu-22, Debian-11, Debian-12 ] - build_type: [ Debug ] - include: - - name: Ubuntu-20 - image: "ubuntu:20.04" - - name: Ubuntu-22 - image: "ubuntu:22.04" - - name: Debian-11 - image: "debian:11" - - name: Debian-12 - image: "debian:12" - - steps: - - uses: actions/checkout@v4 - with: - lfs: false - - - name: Cache dependencies(apt) - id: cache-dependencies-apt - uses: actions/cache@v4 - with: - path: .github/cache/dependencies-apt - key: ${{ matrix.image }}-dependencies-apt-v1 - - - name: Prepare container(apt download) - shell: bash - if: steps.cache-dependencies-apt.outputs.cache-hit != 'true' && (startsWith(matrix.image, 'debian:') || startsWith(matrix.image, 'ubuntu:')) - run: | - sudo apt-get update -qq - sudo apt-get install -yq --download-only build-essential clang-11 cmake libboost-all-dev libssl-dev libgtest-dev - cp /var/cache/apt/archives/*.deb .github/cache/dependencies-apt/ - - - - test-fixture: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - lfs: false - - - name: Cache test fixtures - id: cache-test-fixtures - uses: actions/cache@v4 - with: - path: test/fixture - key: test-fixtures-v1 - - - name: Download assets(models) - if: steps.cache-test-fixtures.outputs.cache-hit != 'true' - shell: bash - run: | - ./test/fixture/download-test-fixtures.sh diff --git a/.github/workflows/cmake-linux.yml b/.github/workflows/cmake-linux.yml index c8afadf..695ddee 100644 --- a/.github/workflows/cmake-linux.yml +++ b/.github/workflows/cmake-linux.yml @@ -125,19 +125,6 @@ jobs: run: | ./.github/actions/download-onnxruntime-linux.sh - - name: Cache test fixtures - id: cache-test-fixtures - uses: actions/cache@v4 - with: - path: test/fixture - key: test-fixtures-v1 - - - name: Download assets(models) - if: steps.cache-test-fixtures.outputs.cache-hit != 'true' - shell: bash - run: | - ./test/fixture/download-test-fixtures.sh - - name: Set reusable strings # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. id: strings @@ -159,6 +146,19 @@ jobs: # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 4 + - name: Cache test fixtures + id: cache-test-fixtures + uses: actions/cache@v4 + with: + path: test/fixture + key: test-fixtures-v1 + + - name: Download assets(models) + if: steps.cache-test-fixtures.outputs.cache-hit != 'true' + shell: bash + run: | + ./test/fixture/download-test-fixtures.sh + - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). diff --git a/.github/workflows/cmake-macos.yml b/.github/workflows/cmake-macos.yml index 707f35b..8a52638 100644 --- a/.github/workflows/cmake-macos.yml +++ b/.github/workflows/cmake-macos.yml @@ -33,19 +33,6 @@ jobs: brew update HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake onnxruntime boost openssl googletest - - name: Cache test fixtures - id: cache-test-fixtures - uses: actions/cache@v4 - with: - path: test/fixture - key: test-fixtures-v1 - - - name: Download assets(models) - if: steps.cache-test-fixtures.outputs.cache-hit != 'true' - shell: bash - run: | - ./test/fixture/download-test-fixtures.sh - - name: Set reusable strings # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. id: strings @@ -67,6 +54,19 @@ jobs: # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 4 + - name: Cache test fixtures + id: cache-test-fixtures + uses: actions/cache@v4 + with: + path: test/fixture + key: test-fixtures-v1 + + - name: Download assets(models) + if: steps.cache-test-fixtures.outputs.cache-hit != 'true' + shell: bash + run: | + ./test/fixture/download-test-fixtures.sh + - name: Test working-directory: ${{ steps.strings.outputs.build-output-dir }} # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).