From 8567f8980274eb2c660810b118d6b5f944a43ce8 Mon Sep 17 00:00:00 2001 From: Jason Pearson Date: Fri, 27 Sep 2024 15:59:00 -0500 Subject: [PATCH] add jemalloc to ci --- .github/actions/jemalloc-linux/action.yml | 50 +++++++++++++++++++++++ .github/workflows/Build.yaml | 6 +++ 2 files changed, 56 insertions(+) create mode 100644 .github/actions/jemalloc-linux/action.yml diff --git a/.github/actions/jemalloc-linux/action.yml b/.github/actions/jemalloc-linux/action.yml new file mode 100644 index 000000000..db3f9b6a9 --- /dev/null +++ b/.github/actions/jemalloc-linux/action.yml @@ -0,0 +1,50 @@ +#file: noinspection YAMLSchemaValidation +name: "jemalloc-linux" +description: "" + +runs: + using: "composite" + steps: + - name: "Restore jemalloc" + id: cache-jemalloc + uses: actions/cache/restore@v3 + with: + path: /tmp/libjemalloc.so.2 + key: v2-${{ runner.os }}-jemalloc-5.3.0 + + - name: "Relocate jemalloc to expected directory" + if: steps.cache-jemalloc.outputs.cache-hit == 'true' + shell: bash + run: sudo mv /tmp/libjemalloc.so.2 /usr/local/lib/ + + - name: "Download jemalloc" + if: steps.cache-jemalloc.outputs.cache-hit != 'true' + shell: bash + run: curl -Ls https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2 -o jemalloc-5.3.0.tar.bz2 + + - name: "Unzip jemalloc" + if: steps.cache-jemalloc.outputs.cache-hit != 'true' + shell: bash + run: tar xvf jemalloc-5.3.0.tar.bz2 + + - name: "Configure jemalloc" + if: steps.cache-jemalloc.outputs.cache-hit != 'true' + shell: bash + run: | + cd jemalloc-5.3.0 + ./configure + make + sudo make install + + - name: "Configure LD_PRELOAD" + shell: bash + run: | + echo 'export LD_PRELOAD=/usr/local/lib/libjemalloc.so.2 app' >> $GITHUB_ENV + cp /usr/local/lib/libjemalloc.so.2 /tmp/ + + - name: "Save jemalloc" + uses: actions/cache/save@v3 + if: steps.cache-jemalloc.outputs.cache-hit != 'true' + with: + path: /tmp/libjemalloc.so.2 + key: v2-${{ runner.os }}-jemalloc-5.3.0 diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yaml index c67d3b3d8..90d605635 100644 --- a/.github/workflows/Build.yaml +++ b/.github/workflows/Build.yaml @@ -41,6 +41,9 @@ jobs: distribution: 'zulu' java-version: 17 + - uses: ./.github/actions/jemalloc-linux + id: cache-jemalloc + - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 @@ -199,6 +202,9 @@ jobs: distribution: 'zulu' java-version: 17 + - uses: ./.github/actions/jemalloc-linux + id: cache-jemalloc + - name: Setup Gradle uses: gradle/actions/setup-gradle@v4 with: