Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: optimize pipeline #49

Merged
merged 2 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 0 additions & 69 deletions .github/workflows/asset-cache.yml

This file was deleted.

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 @@ -62,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
Expand All @@ -96,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).
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 @@ -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
Expand All @@ -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).
Expand Down