Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/.github/workflows/test.yml
blob: e0d56e3603adc079bd29147513c904dd82c2a54a (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
109
110
111
112
113
114
115
116
117
---

name: Test

on:
  push:
  pull_request:
  schedule:
    - cron: '9 0 * * 1'

jobs:

  test:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v3
      - name: Install dependencies
        run: sudo apt-get update && sudo apt-get -y install
             apparmor-utils
             docbook-xml
             docbook2x
             expect
             ldap-utils
             libkrb5-dev
             libldap2-dev
             libpam0g-dev
             libsasl2-dev
             pylint
             python3
             python3-daemon
             python3-ldap
             python3-pyasn1
             python3-pyasn1-modules
             python3-setproctitle
             slapd
             xmlto
      - name: autogen.sh
        run: ./autogen.sh
      - name: configure
        run: ./configure
             --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc
             --libdir=/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`
             --with-pam-seclib-dir=/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`/security
             --enable-warnings --enable-pynslcd
      - name: make
        run: make
      - name: make distcheck
        run: make distcheck || ( cat nss-pam-ldapd-*/_build/sub/tests/test-suite.log 2> /dev/null; exit 1 )
      # Set up a custom LDAP server
      - name: service slapd stop
        run: sudo service slapd stop || true
      - name: aa-disable slapd
        run: sudo aa-disable slapd
      - name: start custom LDAP server
        run: tmpslapd="$(sudo mktemp -d -t slapd.XXXXXX)" && sudo tests/setup_slapd.sh "$tmpslapd" setup && sudo tests/setup_slapd.sh "$tmpslapd" start || sudo tests/setup_slapd.sh "$tmpslapd" start -d 320
      # Set up the system to use LDAP for authentication
      - name: make install
        run: sudo make install
      - name: testenv.sh enable_nss
        run: sudo tests/testenv.sh enable_nss passwd group shadow networks protocols services ethers rpc netgroup aliases
      - name: testenv.sh enable_pam
        run: sudo tests/testenv.sh enable_pam
      - name: configure /etc/nslcd.conf
        run: sudo su -c "cat tests/nslcd-test.conf > /etc/nslcd.conf && chmod 640 /etc/nslcd.conf && chown root:$(id -g -n) /etc/nslcd.conf"
      # Run nslcd and run the tests
      - name: start nslcd
        run: sudo nslcd/nslcd
      - name: check test set-up
        run: sudo tests/testenv.sh check && sudo tests/testenv.sh check_nss passwd group shadow networks protocols services ethers rpc netgroup aliases
      - name: make check
        run: sudo rm -f /tmp/pynslcd_cache.sqlite; sudo make check || ( cat tests/test-suite.log 2> /dev/null; exit 1 )

  CodeQL:
    runs-on: ubuntu-latest
    permissions:
      actions: read
      contents: read
      security-events: write
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - name: Initialize CodeQL
        uses: github/codeql-action/init@v2
        with:
          languages: cpp, python
      - name: Install dependencies
        run: sudo apt-get update && sudo apt-get -y install
             apparmor-utils
             docbook-xml
             docbook2x
             expect
             ldap-utils
             libkrb5-dev
             libldap2-dev
             libpam0g-dev
             libsasl2-dev
             pylint
             python3
             python3-daemon
             python3-ldap
             python3-pyasn1
             python3-pyasn1-modules
             python3-setproctitle
             slapd
             xmlto
      - name: autogen.sh
        run: ./autogen.sh
      - name: configure
        run: ./configure
             --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc
             --libdir=/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`
             --with-pam-seclib-dir=/lib/`dpkg-architecture -qDEB_HOST_MULTIARCH`/security
             --enable-warnings --enable-pynslcd
      - name: make
        run: make
      - name: Perform CodeQL Analysis
        uses: github/codeql-action/analyze@v2