summaryrefslogtreecommitdiffstats
path: root/.github/workflows/debian.yml
blob: e5bcc979f71d6690a63dc65a2e9bafae559d680b (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
97
98
99
100
101
102
103
104
105
106
107
108
name: debian

on:
  push:
    branches:
      - main
      - 'release/**'
    paths-ignore:
      - '/*.sh'
      - '/.*'
      - '/_*'
      - 'Brewfile'
      - 'docs/**'
      - '**.adoc'
      - '**.md'
      - '**.nix'
      - 'flake.lock'
      - '.github/workflows/*.yml'
      - '!.github/workflows/debian.yml'
  pull_request:
    paths-ignore:
      - '/*.sh'
      - '/.*'
      - '/_*'
      - 'Brewfile'
      - 'docs/**'
      - '**.adoc'
      - '**.md'
      - '**.nix'
      - 'flake.lock'

concurrency:
  group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
  cancel-in-progress: true

env:
  CORES: 2
  LANG: C.UTF-8
  LC_ALL: C.UTF-8
  LC_LANG: C.UTF-8
  RNP_LOG_CONSOLE: 1

jobs:
  tests:
    name: ${{ matrix.image.container }} [CC ${{ matrix.env.CC }}; backend ${{ matrix.image.backend }}; GnuPG system-shipped]
    runs-on: ubuntu-latest
    if: "!contains(github.event.head_commit.message, 'skip ci')"
    timeout-minutes: 120
    strategy:
      fail-fast: false
      matrix:
        image:
          - { container: 'debian-11-i386',  cpu: 'i386',   backend: 'botan'   }
          - { container: 'debian-11-i386',  cpu: 'i386',   backend: 'openssl' }
          - { container: 'debian-11-amd64', cpu: 'x86_64', backend: 'botan'   }
          - { container: 'debian-11-amd64', cpu: 'x86_64', backend: 'openssl' }
          - { container: 'debian-12-amd64', cpu: 'x86_64', backend: 'botan'   }
          - { container: 'debian-12-amd64', cpu: 'x86_64', backend: 'openssl' }
          - { container: 'debian-10-i386',  cpu: 'i386',   backend: 'botan'   }
        env:
          - { CC: 'gcc',   CXX: 'g++'     }
          - { CC: 'clang', CXX: 'clang++' }

    container: ghcr.io/rnpgp/ci-rnp-${{ matrix.image.container }}

    env: ${{ matrix.env }}
    steps:
      - name: Checkout on x86_x64
        if: matrix.image.cpu == 'x86_64'
        uses: actions/checkout@v3
        with:
          submodules: true

      - name: Checkout on i386
        if: matrix.image.cpu == 'i386'
        uses: actions/checkout@v1
        with:
          submodules: true

      - name: Setup environment
        shell: bash
        # rnpuser is only needed for rnpkeys_generatekey_verifykeyHomeDirNoPermission test
        run: |
          useradd rnpuser
          printf "\nrnpuser\tALL=(ALL)\tNOPASSWD:\tALL" > /etc/sudoers.d/rnpuser
          printf "\nrnpuser\tsoft\tnproc\tunlimited\n" > /etc/security/limits.d/30-rnpuser.conf

      - name: Configure
        run: |
          cmake -B build                                           \
                -DBUILD_SHARED_LIBS=ON                             \
                -DCRYPTO_BACKEND=${{ matrix.image.backend }}       \
                -DDOWNLOAD_GTEST=ON                                \
                -DCMAKE_BUILD_TYPE=Release                         .

      - name: Build
        run: cmake --build build --parallel ${{ env.CORES }}

      - name: Test
        run: |
          mkdir -p "build/Testing/Temporary"
          cp "cmake/CTestCostData.txt" "build/Testing/Temporary"
          export PATH="$PWD/build/src/lib:$PATH"
          chown -R rnpuser:rnpuser $PWD
          exec su rnpuser -c "ctest --parallel ${{ env.CORES }} --test-dir build --output-on-failure"

      - name: Package
        run: cpack -G DEB -B debian --config build/CPackConfig.cmake