From: romeroalx Date: Mon, 8 Apr 2024 11:13:28 +0000 (+0200) Subject: simplify build-auth job X-Git-Tag: rec-5.1.0-alpha1~23^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c344e4b226f53ca9b16d1a906f2167b12adb8257;p=thirdparty%2Fpdns.git simplify build-auth job --- diff --git a/.github/workflows/build-and-test-all.yml b/.github/workflows/build-and-test-all.yml index b500472a70..e2ef3b82c3 100644 --- a/.github/workflows/build-and-test-all.yml +++ b/.github/workflows/build-and-test-all.yml @@ -44,11 +44,11 @@ jobs: strategy: matrix: include: - - build_system: meson + - builder: autootols + sanitizers: asan+ubsan + - builder: meson sanitizers: address,undefined build_option: '--meson' - - build_system: autotools - sanitizers: asan+ubsan fail-fast: false defaults: run: @@ -71,51 +71,36 @@ jobs: uses: actions/cache@v4 with: path: ~/.ccache - key: auth-ccache-${{ steps.get-stamp.outputs.stamp }} - restore-keys: auth-ccache- + key: auth-ccache-${{ matrix.builder }}-${{ steps.get-stamp.outputs.stamp }} + restore-keys: auth-ccache-${{ matrix.builder }} - name: set sanitizers run: echo "SANITIZERS=${{ matrix.sanitizers }}" >> "$GITHUB_ENV" working-directory: . - - if: ${{ matrix.build_system == 'autotools' }} - run: inv ci-autoconf - working-directory: . - - if: ${{ matrix.build_system == 'autotools' }} - run: inv ci-auth-configure - working-directory: . - - if: ${{ matrix.build_system == 'autotools' }} - run: inv ci-make-distdir + - run: inv install-auth-build-deps working-directory: . - - if: ${{ matrix.build_system == 'autotools' }} - run: inv ci-auth-configure - - if: ${{ matrix.build_system == 'autotools' }} - run: inv ci-auth-make-bear # This runs under pdns-$BUILDER_VERSION/pdns/ - - if: ${{ matrix.build_system == 'meson' }} - run: inv install-meson + - run: inv ci-autoconf ${{ matrix.build_option }} working-directory: . - - if: ${{ matrix.build_system == 'meson' }} - run: inv ci-auth-configure-meson ${{ env.REPO_HOME }}/pdns-${{ env.BUILDER_VERSION }} + - run: inv ci-auth-configure ${{ matrix.build_option }} -b pdns-${{ env.BUILDER_VERSION }} working-directory: . - - if: ${{ matrix.build_system == 'meson' }} - run: inv run-ninja + - run: inv ci-auth-build ${{ matrix.build_option }} # This runs under pdns-$BUILDER_VERSION/pdns/ for make bear - run: inv ci-auth-install-remotebackend-test-deps - run: inv ci-auth-run-unit-tests ${{ matrix.build_option }} - run: inv generate-coverage-info ./testrunner $GITHUB_WORKSPACE - if: ${{ env.COVERAGE == 'yes' && matrix.build_system == 'autotools' }} + if: ${{ env.COVERAGE == 'yes' && matrix.builder != 'meson' }} working-directory: ./pdns-${{ env.BUILDER_VERSION }}/pdns - name: Coveralls Parallel auth unit - if: ${{ env.COVERAGE == 'yes' && matrix.build_system == 'autotools'}} + if: ${{ env.COVERAGE == 'yes' && matrix.builder != 'meson' }} uses: coverallsapp/github-action@v2 with: flag-name: auth-unit-${{ matrix.sanitizers }} path-to-lcov: $GITHUB_WORKSPACE/coverage.lcov parallel: true allow-empty: true - - if: ${{ matrix.build_system == 'autotools' }} - run: inv ci-make-install ${{ matrix.build_option }} + - run: inv ci-auth-install ${{ matrix.build_option }} - run: ccache -s - - if: ${{ matrix.build_system == 'autotools' }} + - if: ${{ matrix.builder != 'meson' }} run: echo "normalized-branch-name=${{ inputs.branch-name || github.ref_name }}" | tr "/" "-" >> "$GITHUB_ENV" - - if: ${{ matrix.build_system == 'autotools' }} + - if: ${{ matrix.builder != 'meson' }} name: Store the binaries uses: actions/upload-artifact@v4 # this takes 30 seconds, maybe we want to tar with: diff --git a/tasks.py b/tasks.py index a13b8c74eb..ad5327cfac 100644 --- a/tasks.py +++ b/tasks.py @@ -176,7 +176,7 @@ def ci_install_rust(c, repo): c.run('sudo sh install_rust.sh') def install_libdecaf(c, product): - c.run('git clone https://git.code.sf.net/p/ed448goldilocks/code /tmp/libdecaf') + c.run('rm -rf /tmp/libdecaf && git clone https://git.code.sf.net/p/ed448goldilocks/code /tmp/libdecaf') with c.cd('/tmp/libdecaf'): c.run('git checkout 41f349') c.run(f'CC={get_c_compiler()} CXX={get_cxx_compiler()} ' @@ -199,9 +199,14 @@ def install_doc_deps(c): def install_doc_deps_pdf(c): c.sudo('apt-get install -y ' + ' '.join(doc_deps_pdf)) +def install_meson(c): + c.run(f'python3 -m venv {repo_home}/.venv') + c.run(f'. {repo_home}/.venv/bin/activate && pip install meson pyyaml ninja') + @task def install_auth_build_deps(c): c.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps + git_build_deps + auth_build_deps)) + install_meson(c) if os.getenv('DECAF_SUPPORT', 'no') == 'yes': install_libdecaf(c, 'pdns-auth') @@ -338,8 +343,9 @@ def install_dnsdist_build_deps(c, skipXDP=False): c.sudo('apt-get install -y --no-install-recommends ' + ' '.join(all_build_deps + git_build_deps + dnsdist_build_deps + (dnsdist_xdp_build_deps if not skipXDP else []))) @task -def ci_autoconf(c): - c.run('autoreconf -vfi') +def ci_autoconf(c, meson=False): + if not meson: + c.run('autoreconf -vfi') @task def ci_docs_rec_generate(c): @@ -472,8 +478,7 @@ def get_base_configure_cmd_meson(build_dir, additional_c_flags='', additional_cx get_sanitizers(meson=True) ]) -@task -def ci_auth_configure(c): +def ci_auth_configure_autotools(c): unittests = get_unit_tests(auth=True) fuzz_targets = get_fuzzing_targets() modules = " ".join([ @@ -512,7 +517,6 @@ def ci_auth_configure(c): c.run('cat config.log') raise UnexpectedExit(res) -@task def ci_auth_configure_meson(c, build_dir): unittests = get_unit_tests(meson=True, auth=True) fuzz_targets = get_fuzzing_targets(meson=True) @@ -547,6 +551,17 @@ def ci_auth_configure_meson(c, build_dir): c.run(f'cat {build_dir}/meson-logs/meson-log.txt') raise UnexpectedExit(res) +@task +def ci_auth_configure(c, build_dir=None, meson=False): + if meson: + ci_auth_configure_meson(c, build_dir) + else: + ci_auth_configure_autotools(c) + if build_dir: + ci_make_distdir(c) + with c.cd(f'{build_dir}'): + ci_auth_configure_autotools(c) + @task def ci_rec_configure(c, features): unittests = get_unit_tests() @@ -680,6 +695,16 @@ def ci_auth_make(c): def ci_auth_make_bear(c): c.run(f'bear --append -- make -j{get_build_concurrency()} -k V=1') +def run_ninja(c): + c.run(f'. {repo_home}/.venv/bin/activate && ninja -j{get_build_concurrency()} --verbose') + +@task +def ci_auth_build(c, meson=False): + if meson: + run_ninja(c) + else: + ci_auth_make_bear(c) + @task def ci_rec_make(c): c.run(f'make -j{get_build_concurrency()} -k V=1') @@ -735,18 +760,13 @@ def ci_make_distdir(c): c.run('make distdir') @task -def ci_make_install(c, meson=False): - # TBD: meson: ninja install or equivalent - c.run('make install') # FIXME: this builds auth docs - again +def ci_auth_install(c, meson=False): + if not meson: + c.run('make install') # FIXME: this builds auth docs - again @task -def install_meson(c): - c.run(f'python3 -m venv {repo_home}/.venv') - c.run(f'. {repo_home}/.venv/bin/activate && pip install meson pyyaml ninja') - -@task -def run_ninja(c): - c.run(f'. {repo_home}/.venv/bin/activate && ninja --verbose') +def ci_make_install(c): + c.run('make install') @task def add_auth_repo(c, dist_name, dist_release_name, pdns_repo_version):