Skip to content

Commit

Permalink
ci: optimize pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
kibae committed Mar 17, 2024
1 parent 94a9da5 commit 82390a3
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 26 deletions.
89 changes: 76 additions & 13 deletions .github/workflows/cmake-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -63,19 +126,6 @@ jobs:
run: |
./onnxruntime-server/.github/actions/download-onnxruntime-linux.sh
- name: Cache test fixtures
id: cache-test-fixtures
uses: actions/cache@v4
with:
path: onnxruntime-server/test/fixture
key: test-fixtures-v1

- name: Download assets(models)
if: steps.cache-test-fixtures.outputs.cache-hit != 'true'
shell: bash
run: |
./onnxruntime-server/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
Expand All @@ -99,6 +149,19 @@ jobs:
cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 4
sudo cmake --install ${{ steps.strings.outputs.build-output-dir }}/pg_onnx
- name: Cache test fixtures
id: cache-test-fixtures
uses: actions/cache@v4
with:
path: onnxruntime-server/test/fixture
key: test-fixtures-v1

- name: Download assets(models)
if: steps.cache-test-fixtures.outputs.cache-hit != 'true'
shell: bash
run: |
./onnxruntime-server/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).
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/cmake-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,6 @@ jobs:
brew update
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake onnxruntime boost postgresql googletest
- name: Cache test fixtures
id: cache-test-fixtures
uses: actions/cache@v4
with:
path: onnxruntime-server/test/fixture
key: test-fixtures-v1

- name: Download assets(models)
if: steps.cache-test-fixtures.outputs.cache-hit != 'true'
shell: bash
run: |
./onnxruntime-server/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
Expand All @@ -70,6 +57,19 @@ jobs:
cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 4
sudo cmake --install ${{ steps.strings.outputs.build-output-dir }}/pg_onnx
- name: Cache test fixtures
id: cache-test-fixtures
uses: actions/cache@v4
with:
path: onnxruntime-server/test/fixture
key: test-fixtures-v1

- name: Download assets(models)
if: steps.cache-test-fixtures.outputs.cache-hit != 'true'
shell: bash
run: |
./onnxruntime-server/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).
Expand Down

0 comments on commit 82390a3

Please sign in to comment.