aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci_rspamd.yml
blob: c6e4347f98b92c91deb2e8c1ca923cbeb2f97fa9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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: ["ubuntu-latest"]
    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}