diff options
author | Andrew Lewis <nerf@judo.za.org> | 2024-03-13 18:00:17 +0200 |
---|---|---|
committer | Andrew Lewis <nerf@judo.za.org> | 2024-03-14 14:51:50 +0200 |
commit | 6aee123f55dba79d76ab0a5395093ddd5a7f4988 (patch) | |
tree | 330f654a60b0c3163c53d1cc2fc329dd21754287 /.github | |
parent | 41e564da7af9c552cef0640c1fddb235cafd854e (diff) | |
download | rspamd-6aee123f55dba79d76ab0a5395093ddd5a7f4988.tar.gz rspamd-6aee123f55dba79d76ab0a5395093ddd5a7f4988.zip |
[Test] Migrate to Github Actions
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/ci.yml | 25 | ||||
-rw-r--r-- | .github/workflows/ci_eslint.yml | 25 | ||||
-rw-r--r-- | .github/workflows/ci_linters.yml | 14 | ||||
-rw-r--r-- | .github/workflows/ci_luacheck.yml | 16 | ||||
-rw-r--r-- | .github/workflows/ci_rspamd.yml | 99 | ||||
-rw-r--r-- | .github/workflows/ci_tidyall.yml | 23 |
6 files changed, 202 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..6544bd3f0 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: ci + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + linters: + uses: ./.github/workflows/ci_linters.yml + + fedora: + uses: ./.github/workflows/ci_rspamd.yml + with: + image: ghcr.io/fatalbanana/gha-images:fedora-ci + name: fedora-ci + + ubuntu: + uses: ./.github/workflows/ci_rspamd.yml + with: + image: ghcr.io/fatalbanana/gha-images:ubuntu-ci + name: ubuntu-ci diff --git a/.github/workflows/ci_eslint.yml b/.github/workflows/ci_eslint.yml new file mode 100644 index 000000000..e7220d468 --- /dev/null +++ b/.github/workflows/ci_eslint.yml @@ -0,0 +1,25 @@ +name: ci_eslint + +on: + workflow_call: + +jobs: + eslint: + runs-on: ubuntu-latest + container: + image: node:18-alpine + steps: + - name: Check out source code + uses: actions/checkout@v4 + + - name: Install dependencies + run: npm install + + - name: Show installed packages + run: npm ls + + - name: Run eslint + run: ./node_modules/.bin/eslint ./ + + - name: Run stylelint + run: ./node_modules/.bin/stylelint ./**/*.css ./**/*.html ./**/*.js diff --git a/.github/workflows/ci_linters.yml b/.github/workflows/ci_linters.yml new file mode 100644 index 000000000..6df1a4480 --- /dev/null +++ b/.github/workflows/ci_linters.yml @@ -0,0 +1,14 @@ +name: ci_linters + +on: + workflow_call: + +jobs: + eslint: + uses: ./.github/workflows/ci_eslint.yml + + luacheck: + uses: ./.github/workflows/ci_luacheck.yml + + tidyall: + uses: ./.github/workflows/ci_tidyall.yml diff --git a/.github/workflows/ci_luacheck.yml b/.github/workflows/ci_luacheck.yml new file mode 100644 index 000000000..d930fdae5 --- /dev/null +++ b/.github/workflows/ci_luacheck.yml @@ -0,0 +1,16 @@ +name: ci_luacheck + +on: + workflow_call: + +jobs: + luacheck: + runs-on: ubuntu-latest + container: + image: pipelinecomponents/luacheck + steps: + - name: Check out source code + uses: actions/checkout@v4 + + - name: Run luacheck + run: luacheck -q --no-color . diff --git a/.github/workflows/ci_rspamd.yml b/.github/workflows/ci_rspamd.yml new file mode 100644 index 000000000..7c32e1cdc --- /dev/null +++ b/.github/workflows/ci_rspamd.yml @@ -0,0 +1,99 @@ +name: rspamd_test + +on: + workflow_call: + inputs: + image: + required: true + type: string + name: + required: true + type: string + +env: + CTEST_OUTPUT_ON_FAILURE: 1 + JOB_WORKDIR: ${{ github.workspace }}/${{ github.job }}-${{ inputs.name }}-${{ github.run_number }} + RSPAMD_LUA_EXPENSIVE_TESTS: 1 + +jobs: + test: + runs-on: ["self-hosted", "linux", "${{ matrix.arch }}"] + strategy: + matrix: + arch: [ARM64, X64] + container: + image: ${{ inputs.image }} + steps: + - name: Create directories + run: | + sudo mkdir -p ${JOB_WORKDIR} + sudo chown -R build:build ${JOB_WORKDIR} + + - name: Check out the repo + run: | + cd ${JOB_WORKDIR} + git clone ${{ github.server_url }}/${{ github.repository }} --branch ${{ github.ref_name }} --single-branch src + + - name: Set variables on ARM64 + if: runner.arch == 'ARM64' + run: echo "HYPERSCAN_ALTROOT=-DHYPERSCAN_ROOT_DIR=/vectorscan" >> "$GITHUB_ENV" + + - name: Run cmake + run: | + mkdir ${JOB_WORKDIR}/build + cd ${JOB_WORKDIR}/build + cmake -DCMAKE_INSTALL_PREFIX=${JOB_WORKDIR}/install -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_COVERAGE=ON -DENABLE_LIBUNWIND=ON -DENABLE_HYPERSCAN=ON ${{ env.HYPERSCAN_ALTROOT }} -GNinja ${JOB_WORKDIR}/src + + - name: Build rspamd + run: | + cd ${JOB_WORKDIR}/build + ncpu=$(getconf _NPROCESSORS_ONLN) + ninja -j $ncpu install + ninja -j $ncpu rspamd-test + ninja -j $ncpu rspamd-test-cxx + + - name: Run unit tests + if: "!(inputs.name == 'ubuntu-ci' && runner.arch == 'ARM64')" + run: | + cd ${JOB_WORKDIR}/build + ninja test + + - name: Apply Fedora specifics + if: inputs.name == 'fedora-ci' + run: | + sudo mv /usr/bin/miltertest /usr/bin/miltertest.is.broken.on.fedora || true + + - name: Run functional tests + run: | + cd ${JOB_WORKDIR}/build + ulimit -c unlimited + ulimit -s unlimited + set +e + RSPAMD_INSTALLROOT=${JOB_WORKDIR}/install robot --removekeywords wuks --exclude isbroken ${JOB_WORKDIR}/src/test/functional/cases; EXIT_CODE=$? + set -e + core_files=$(find /var/tmp/ -name '*.core') + for core in $core_files; do exe=$(gdb --batch -ex 'info proc mappings' -c $core | tail -1 | awk '{print $5}'); gdb --batch -ex 'bt' -c $core $exe; echo '---'; done + exit $EXIT_CODE + + # FIXME: upload test logs even on ARM + - name: Upload robot logs + if: runner.arch == 'X64' && (success() || failure()) + uses: actions/upload-artifact@v4 + with: + name: robotlog-${{ inputs.name }} + path: | + ${{ env.JOB_WORKDIR }}/build/*.*ml + retention-days: 1 + + - name: Upload rspamd logs + if: runner.arch == 'X64' && (success() || failure()) + uses: actions/upload-artifact@v4 + with: + name: rspamdlog-${{ inputs.name }} + path: ${{ env.JOB_WORKDIR }}/build/robot-save + retention-days: 1 + + - name: Cleanup working directory + if: always() + run: | + sudo rm -rf ${JOB_WORKDIR} diff --git a/.github/workflows/ci_tidyall.yml b/.github/workflows/ci_tidyall.yml new file mode 100644 index 000000000..af22d8c3a --- /dev/null +++ b/.github/workflows/ci_tidyall.yml @@ -0,0 +1,23 @@ +name: ci_tidyall + +on: + workflow_call: + +jobs: + tidyall: + runs-on: ubuntu-latest + container: + image: rspamd/ci:perl-tidyall + options: --user root + steps: + - name: Check out source code + uses: actions/checkout@v4 + + - name: Show tidyall version + run: tidyall --version + + - name: Show perltidy version + run: perltidy --version | head -1 + + - name: Run tidyall + run: tidyall --all --check-only --no-cache --data-dir /tmp/tidyall |