aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci_rspamd.yml
blob: 8d70a575945c6cf024c53c50adce979a43f2a184 (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
name: rspamd_test

on:
  workflow_call:
    inputs:
      image:
        required: true
        type: string
      name:
        required: true
        type: string

env:
  CTEST_OUTPUT_ON_FAILURE: 1
  CONTAINER_WORKSPACE: ${GITHUB_WORKSPACE}
  RSPAMD_LUA_EXPENSIVE_TESTS: 1

jobs:
  test:
    runs-on: ["ubuntu-latest"]
    container:
      image: ${{ inputs.image }}
    steps:
      - name: Create directories
        run: |
          sudo mkdir -p ${GITHUB_WORKSPACE}
          sudo chown -R build:build ${GITHUB_WORKSPACE}

      - name: Check out the repo
        run: |
          cd ${GITHUB_WORKSPACE}
          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 ${GITHUB_WORKSPACE}/build
          cd ${GITHUB_WORKSPACE}/build
          cmake -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/install -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_COVERAGE=ON -DENABLE_LIBUNWIND=ON -DENABLE_HYPERSCAN=ON ${{ env.HYPERSCAN_ALTROOT }} -GNinja ${GITHUB_WORKSPACE}/src

      - name: Build rspamd
        run: |
          cd ${GITHUB_WORKSPACE}/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 ${GITHUB_WORKSPACE}/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 ${GITHUB_WORKSPACE}/build
          ulimit -c unlimited
          ulimit -s unlimited
          set +e
          RSPAMD_INSTALLROOT=${GITHUB_WORKSPACE}/install robot --removekeywords wuks --exclude isbroken ${GITHUB_WORKSPACE}/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.CONTAINER_WORKSPACE }}/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.CONTAINER_WORKSPACE }}/build/robot-save
          retention-days: 1