From eb674e1fc527c04f5c233fcc6aad043d76165c6d Mon Sep 17 00:00:00 2001 From: wangyunlai <90242350+hnwyllmm1@users.noreply.github.com> Date: Wed, 19 Jul 2023 10:08:20 +0800 Subject: [PATCH] use matrix to remove redundant code --- .github/workflows/compile.yml | 57 ++++++----------------------------- 1 file changed, 9 insertions(+), 48 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 4b445979f..e26597d0f 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -7,7 +7,7 @@ on: branches: [ master ] jobs: - ubuntu-x86_64: + build: strategy: matrix: image: [ubuntu-20.04, centos:7] @@ -16,9 +16,15 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install environment + - name: Install ubuntu environment shell: bash - run: sudo apt-get install -y git wget rpm rpm2cpio cpio make build-essential binutils m4 libtool-bin language-pack-en + if: startsWith(${{ matrix.image }}, 'ubuntu') + run: sudo apt-get install -y git wget rpm rpm2cpio cpio make build-essential binutils m4 libtool-bin + + - name: Install centos environment + shell: bash + if: startsWith(${{ matrix.image }}, 'centos') + run: sudo yum install -y git wget rpm* cpio make glibc-devel glibc-headers binutils m4 - name: Cache deps id: cache-deps @@ -56,48 +62,3 @@ jobs: cd build_debug && make -j4 && cd - deps/3rd/usr/local/oceanbase/devtools/bin/ccache -s cat $PWD/ccache.log - - centos-x86_64: - runs-on: ubuntu-20.04 - container: centos:7 - steps: - - uses: actions/checkout@v3 - - - name: Install environment - shell: bash - run: yum install -y git wget rpm* cpio make glibc-devel glibc-headers binutils m4 - - - name: Cache deps - id: cache-deps - uses: actions/cache@v3 - env: - cache-name: cache-deps - with: - key: ${{ runner.os }}-build-${{ env.cache-name }}-el7.x86_64-${{ hashFiles('deps/init/oceanbase.el7.x86_64.deps') }} - path: deps/3rd - enableCrossOsArchive: true - - - name: cache-build - id: cache-build - uses: actions/cache@v3 - env: - cache-name: cache-build - with: - key: ${{ runner.os }}-${{ env.cache-name }}-el7.x86_64-${{ github.ref_name }} - path: ~/.ccache - enableCrossOsArchive: false - restore-keys: | - ${{ runner.os }}-${{ env.cache-name }}-el7.x86_64 - - - name: Build init - if: steps.cache-deps.outputs.cache-hit != 'true' - run: bash build.sh init - - - name: Build project - shell: bash - run: | - rm -rf build_debug - deps/3rd/usr/local/oceanbase/devtools/bin/ccache -z - bash build.sh debug -DOB_USE_CCACHE=ON - cd build_debug && make -j4 && cd - - deps/3rd/usr/local/oceanbase/devtools/bin/ccache -s