From 7ab6c65b7df1bf3df4e788d0e1d32e1c8bf3f274 Mon Sep 17 00:00:00 2001 From: Geod24 Date: Wed, 7 Sep 2022 00:54:15 +0200 Subject: [PATCH] CI: Move ebtree build to a reusable workflow --- .github/workflows/ci.yml | 112 +++++++++++++---------------------- .github/workflows/ebtree.yml | 56 ++++++++++++++++++ 2 files changed, 97 insertions(+), 71 deletions(-) create mode 100644 .github/workflows/ebtree.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3ec5cc01..3c0a9224e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,8 +5,12 @@ name: CI on: [push, pull_request] jobs: - main: - name: Run + setup-ebtree: + uses: ./.github/workflows/ebtree.yml + with: + os: ubuntu-18.04 + + test: strategy: # Disable `fail-fast` because even if things fail for one compiler release # or build flavour we still want to see how things perform with the others @@ -15,83 +19,49 @@ jobs: os: [ ubuntu-18.04 ] dc: [ dmd-2.092.1, dmd-2.093.1 ] flavor: [ prod, devel ] - # Not a matrix row, but referenced as a constant in this file - ebtree_version: [ v6.0.socio10 ] include: - { dc: dmd-2.093.1, coverage: 1, closure_check: 1 } runs-on: ${{ matrix.os }} timeout-minutes: 30 steps: - - name: "Ensure tools/ exists" - run: mkdir -p ${{ github.workspace }}/tools/ - - - name: 'Restore ebtree ${{ matrix.ebtree_version }} from cache' - id: cache-ebtree - uses: actions/cache@v1 - with: - path: ${{ github.workspace }}/tools/ - key: ebtree-${{ matrix.ebtree_version }} - - - name: 'Checkout ebtree ${{ matrix.ebtree_version }}' - uses: actions/checkout@v2 - if: steps.cache-ebtree.outputs.cache-hit != 'true' - with: - repository: sociomantic-tsunami/ebtree - ref: ${{ matrix.ebtree_version }} - # Relative to Github workspace - path: tools/ebtree - - - name: 'Build ebtree ${{ matrix.ebtree_version }}' - if: steps.cache-ebtree.outputs.cache-hit != 'true' - run: | - # fpm is used to build the `.deb` and depends on ruby - sudo apt-get update - sudo apt-get install -y build-essential ruby ruby-dev - sudo gem install --no-document fpm - # Build the debian package - # Package lives in tools/ebtree/deb/libebtree6[-{dbg,dev}]_$VERSION-distro_arch.deb - # $VERSION is ${{ matrix.ebtree_version }} without the leading 'v' - # E.g. libebtree6[-{dbg,dev}]_6.0.socio10-bionic_amd64.deb - make -C '${{ github.workspace }}/tools/ebtree' deb - - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y libxslt-dev liblzo2-dev libgcrypt-dev libgpg-error-dev - sudo dpkg -i ${{ github.workspace }}/tools/ebtree/deb/libebtree6*.deb + # Checkout this repository and its submodules + - uses: actions/checkout@v2 + with: + submodules: true + # Required for codecov (codecov/codecov-action#190) + fetch-depth: 2 - - name: Install compiler - uses: dlang-community/setup-dlang@v1 - with: - compiler: ${{ matrix.dc }} + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libxslt-dev liblzo2-dev libgcrypt-dev libgpg-error-dev + sudo dpkg -i ${{ github.workspace }}/tools/ebtree/deb/libebtree6*.deb - # Checkout this repository and its submodules - - uses: actions/checkout@v2 - with: - submodules: true - # Required for codecov (codecov/codecov-action#190) - fetch-depth: 2 + - name: Install compiler + uses: dlang-community/setup-dlang@v1 + with: + compiler: ${{ matrix.dc }} - - name: Test - run: | - make all test V=1 F=${{ matrix.flavor }} COV=${{ matrix.coverage }} + - name: Test + run: | + make all test V=1 F=${{ matrix.flavor }} COV=${{ matrix.coverage }} - - name: Test closures - if: ${{ matrix.closure_check == 1 }} - env: - F: ${{ matrix.flavor }} - DFLAGS: -vgc - run: | - # Run tests and write compiler output to temporary file - compiler_output=`mktemp` - make fasttest 2>&1 > $compiler_output - # Ensure there are no lines about closure allocations in the output. - # Note explicit check for `grep` exit status 1, i.e. no lines found. - ! grep -e "closure" $compiler_output + - name: Test closures + if: ${{ matrix.closure_check == 1 }} + env: + F: ${{ matrix.flavor }} + DFLAGS: -vgc + run: | + # Run tests and write compiler output to temporary file + compiler_output=`mktemp` + make fasttest 2>&1 > $compiler_output + # Ensure there are no lines about closure allocations in the output. + # Note explicit check for `grep` exit status 1, i.e. no lines found. + ! grep -e "closure" $compiler_output - - name: 'Upload coverage' - if: ${{ matrix.coverage == 1 }} - uses: codecov/codecov-action@v1 - with: - flags: ${{ matrix.dc }}-${{ matrix.flavor }} + - name: 'Upload coverage' + if: ${{ matrix.coverage == 1 }} + uses: codecov/codecov-action@v1 + with: + flags: ${{ matrix.dc }}-${{ matrix.flavor }} diff --git a/.github/workflows/ebtree.yml b/.github/workflows/ebtree.yml new file mode 100644 index 000000000..03772d012 --- /dev/null +++ b/.github/workflows/ebtree.yml @@ -0,0 +1,56 @@ +# Build and store ebtree in cache + +name: EBTree +on: + workflow_call: + inputs: + os: + type: choice + required: true + options: + - ubuntu-latest + - ubuntu-18.04 + - ubuntu-20.04 + - ubuntu-22.04 + # More a constant than a real input + ebtree_version: + type: string + default: 'v6.0.socio10' + +jobs: + ebtree: + name: Build EBTree + runs-on: ${{ github.event.inputs.os }} + + steps: + - name: "Ensure tools/ exists" + run: mkdir -p ${{ github.workspace }}/tools/ + + - name: 'Restore ebtree ${{ github.event.inputs.ebtree_version }} from cache' + id: cache-ebtree + uses: actions/cache@v1 + with: + path: ${{ github.workspace }}/tools/ + key: ebtree-${{ github.event.inputs.ebtree_version }} + + - name: 'Checkout ebtree ${{ github.event.inputs.ebtree_version }}' + uses: actions/checkout@v2 + if: steps.cache-ebtree.outputs.cache-hit != 'true' + with: + repository: sociomantic-tsunami/ebtree + ref: ${{ github.event.inputs.ebtree_version }} + # Relative to Github workspace + path: tools/ebtree + + - name: 'Build ebtree ${{ github.event.inputs.ebtree_version }}' + if: steps.cache-ebtree.outputs.cache-hit != 'true' + run: | + # fpm is used to build the `.deb` and depends on ruby + sudo apt-get update + sudo apt-get install -y build-essential ruby ruby-dev + sudo gem install --no-document fpm + # Build the debian package + # Package lives in tools/ebtree/deb/libebtree6[-{dbg,dev}]_$VERSION-distro_arch.deb + # $VERSION is ${{ github.event.inputs.ebtree_version }} without the leading 'v' + # E.g. libebtree6[-{dbg,dev}]_6.0.socio10-bionic_amd64.deb + make -C '${{ github.workspace }}/tools/ebtree' deb