source: mod_gnutls/.github/workflows/build.yml @ ed493e6

Last change on this file since ed493e6 was ed493e6, checked in by Fiona Klute <fiona.klute@…>, 7 weeks ago

CI: Detect network addresses for tests

  • Property mode set to 100644
File size: 3.2 KB
Line 
1name: CI build
2on:
3  pull_request:
4  push:
5    # don't run on packaging branches
6    branches-ignore:
7      - 'for-debian'
8      - 'debian/**'
9      - 'pristine-tar'
10jobs:
11  build:
12    strategy:
13      fail-fast: false
14      matrix:
15        container:
16          - 'debian:buster'
17          - 'debian:sid'
18          - 'fedora:32'
19    runs-on: ubuntu-latest
20    container: ${{ matrix.container }}
21    name: ${{ matrix.container }}
22    steps:
23      - uses: actions/checkout@v2
24      - name: install dependencies (Debian)
25        if: startsWith(matrix.container, 'debian')
26        run: |
27          apt-get update
28          apt-get -y install python3-yaml apache2-bin apache2-dev curl gnutls-bin libapr1-dev libgnutls28-dev openssl pandoc pkg-config procps softhsm2
29      - name: install dependencies (Fedora)
30        if: startsWith(matrix.container, 'fedora')
31        run: |
32          dnf -y group install "C Development Tools and Libraries"
33          dnf -y install curl gnutls-devel gnutls-utils httpd-devel iproute python3-pyyaml redhat-rpm-config softhsm
34      - name: network overview
35        run: |
36          ip addr show
37          cat /etc/hosts
38      - name: find usable IPs for tests
39        shell: python3 {0}
40        run: |
41          import socket
42          def try_connect(sockaddr):
43              af, socktype, proto, canonname, sa = sockaddr
44              try:
45                  s = socket.socket(af, socktype, proto)
46                  s.connect(sa)
47              except:
48                  return False
49              finally:
50                  s.close()
51              return True
52
53          test_ips = []
54          for name in ['localhost', socket.gethostname()]:
55              addrs = list(map(lambda t: t[-1][0], filter(try_connect, socket.getaddrinfo(name, 123, proto=socket.IPPROTO_UDP))))
56              print(f'{name}: {addrs}')
57              test_ips += addrs
58          # IPv6 addresses must be enclosed in square brackets
59          test_ips = [f'[{i}]' if ':' in i else i for i in test_ips]
60          print(f'::set-env name=test_ips::{" ".join(test_ips)}')
61      - name: set prefix for container-specific artifacts
62        # this is because upload-artifact doesn't like ":" in file names
63        env:
64          CONTAINER_NAME: ${{ matrix.container }}
65        run: |
66          echo "::set-env name=artifact_prefix::$(echo ${CONTAINER_NAME} | sed s/:/-/)"
67      - name: autoreconf
68        run: autoreconf -fiv
69      - name: configure
70        run: TEST_IP="${test_ips}" APACHE_MUTEX=pthread ./configure
71      - name: store config.log
72        uses: actions/upload-artifact@v1
73        if: failure()
74        with:
75          name: ${{ env.artifact_prefix }}-config-log
76          path: config.log
77      - name: make
78        run: make
79      - name: make check
80        run: VERBOSE=1 make check
81      - name: store Apache logs
82        uses: actions/upload-artifact@v2
83        if: failure() || cancelled()
84        with:
85          name: ${{ env.artifact_prefix }}-apache-logs
86          path: test/logs/
87      - name: store test logs
88        uses: actions/upload-artifact@v2
89        if: failure() || cancelled()
90        with:
91          name: ${{ env.artifact_prefix }}-test-logs
92          path: test/test-*.log
93      - name: make distcheck
94        run: VERBOSE=1 make distcheck
Note: See TracBrowser for help on using the repository browser.