summaryrefslogtreecommitdiffstats
path: root/.github/workflows/unit_tests.yml
blob: 9942df6be2cfe40600895afe9449edc7b4ce0cda (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
---
# vi: ts=2 sw=2 et:
# SPDX-License-Identifier: LGPL-2.1-or-later
#
name: Unit tests
on:
  pull_request:
    branches:
      - main
      - v[0-9]+-stable

permissions:
  contents: read

jobs:
  build:
    runs-on: ubuntu-22.04
    concurrency:
      group: ${{ github.workflow }}-${{ matrix.run_phase }}-${{ matrix.cryptolib }}-${{ github.ref }}
      cancel-in-progress: true
    strategy:
      fail-fast: false
      matrix:
        run_phase: [GCC, GCC_ASAN_UBSAN, CLANG, CLANG_RELEASE, CLANG_ASAN_UBSAN, CLANG_ASAN_UBSAN_NO_DEPS]
        cryptolib: [auto]
        include:
          - run_phase: GCC
            cryptolib: openssl
          - run_phase: CLANG
            cryptolib: gcrypt
    steps:
      - name: Repository checkout
        uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
      # FIXME: drop once https://github.com/actions/runner-images/issues/9491  is resolved
      - name: Reduce ASLR entropy
        run: sudo sysctl -w vm.mmap_rnd_bits=28
      - name: Install build dependencies
        run: |
          # Drop XDG_* stuff from /etc/environment, so we don't get the user
          # XDG_* variables when running under sudo
          sudo sed -i '/^XDG_/d' /etc/environment
          # Pass only specific env variables through sudo, to avoid having
          # the already existing XDG_* stuff on the "other side"
          sudo --preserve-env=CRYPTOLIB,GITHUB_ACTIONS,CI .github/workflows/unit_tests.sh SETUP
      - name: Build & test
        run: sudo --preserve-env=CRYPTOLIB,GITHUB_ACTIONS,CI .github/workflows/unit_tests.sh RUN_${{ matrix.run_phase }}
        env:
          CRYPTOLIB: ${{ matrix.cryptolib }}