performance optimizations #68
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Linux Automatic Nightly Build | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| issues: write | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 2 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| software-properties-common \ | |
| apt-transport-https \ | |
| cmake make git gettext patchelf libtool ninja-build | |
| - name: Configure and Build | |
| run: | | |
| set -euo pipefail | |
| mkdir build; | |
| cd build | |
| { cmake ../src \ | |
| -D CCDB_COMPILE_WITH_IMG="True" \ | |
| -D NCURSES_MAKE_ADDITIONAL_FLAGS="-j$(nproc)" \ | |
| -D READLINE_MAKE_ADDITIONAL_FLAGS="-j$(nproc)" \ | |
| -D OPENSSL_MAKE_ADDITIONAL_FLAGS="-j$(nproc)" \ | |
| -D OPENSSL_TARGET="linux-x86_64" \ | |
| -D OPENSSL_LIBP="lib64" \ | |
| -D PERL_MAKE_ADDITIONAL_FLAGS="-j$(nproc)" \ | |
| -D TAR_MAKE_ENTIRE="-j$(nproc)" 2>&1 \ | |
| -G Ninja \ | |
| && ninja copy_ccdb; } | tee /tmp/log.txt | |
| - name: Upload log artifact | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: build-log | |
| path: /tmp/log.txt | |
| - name: Open an Issue on Test Failure | |
| if: ${{ always() && failure() && github.event_name != 'pull_request' }} | |
| run: | | |
| gh issue create \ | |
| --title "CCDB Linux Build Failed" \ | |
| --body "$(cat <<EOF | |
| # One or more steps have failed! | |
| **Log artifact:** \`build-log\` (download it from the workflow run page) | |
| **Workflow run:** ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} | |
| EOF | |
| )" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pack | |
| run: | | |
| cp build/libccdb.so libccdb.debug_info.so | |
| cp build/libccdb.so libccdb.so | |
| cp build/ccdb ccdb | |
| strip -g -S -d --strip-debug --strip-unneeded ccdb libccdb.so | |
| - name: Compute tag | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| TAG=$(git describe --tags --exact-match 2>/dev/null || true) | |
| SHORT=$(git rev-parse --short=8 HEAD) | |
| if [ -n "$TAG" ]; then | |
| echo "GIT_TAG=$TAG" >> "$GITHUB_ENV" | |
| else | |
| echo "GIT_TAG=ccdb.NightlyBuild.$SHORT" >> "$GITHUB_ENV" | |
| fi | |
| - name: Create and push tag | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| if ! git rev-parse -q --verify "refs/tags/${GIT_TAG}" >/dev/null; then | |
| git tag "${GIT_TAG}" | |
| git push origin "${GIT_TAG}" | |
| fi | |
| - name: Create a GitHub release | |
| if: ${{ github.event_name != 'pull_request' }} | |
| shell: bash | |
| run: | | |
| files=( | |
| ccdb | |
| libccdb.so | |
| libccdb.debug_info.so | |
| ) | |
| if gh release view "${GIT_TAG}" >/dev/null 2>&1; then | |
| gh release upload "${GIT_TAG}" "${files[@]}" --clobber | |
| else | |
| gh release create "${GIT_TAG}" "${files[@]}" \ | |
| --title "${GIT_TAG}" \ | |
| --prerelease | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |