]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
CI: Combine steps for installing and configuring fixtures (#4003)
authorTerry Burton <tez@terryburton.co.uk>
Fri, 19 Mar 2021 11:34:20 +0000 (11:34 +0000)
committerGitHub <noreply@github.com>
Fri, 19 Mar 2021 11:34:20 +0000 (11:34 +0000)
Saves >20 secs.

.github/workflows/ci.yml

index f45395ae6b1c2a07e547d3050deb0262c1f48e81..a6aabcf3bb8e71c4ef29118ccd3b7006b2a79579 100644 (file)
@@ -35,28 +35,6 @@ jobs:
     needs: pre-ci
     if: ${{ needs.pre-ci.outputs.should_skip != 'true' }}
 
-#
-#  Launching these containers takes the best part of a minute, so we configure
-#  the pre-installed, local instances of these services instead.
-#
-#    services:
-#      mysql:
-#        image: mysql
-#        env:
-#          MYSQL_ALLOW_EMPTY_PASSWORD: yes
-#        ports:
-#          - 3306:3306
-#        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
-#
-#      postgres:
-#        image: postgres
-#        env:
-#          POSTGRES_HOST_AUTH_METHOD: trust
-#        ports:
-#          - 5432:5432
-#        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
-#
-
     runs-on: ${{ matrix.env.OS }}
 
     strategy:
@@ -247,55 +225,38 @@ jobs:
         retention-days: 30
       if: ${{ matrix.env.CC == 'clang' && failure() }}
 
-    - name: Install fixture (redis)
-      if: ${{ matrix.env.TEST_TYPE == 'fixtures' }}
-      run: |
-        sudo apt-get install -y --no-install-recommends redis-server redis-tools
-        sudo systemctl start redis-server
-
-    - name: Install fixture (openldap)
+    - name: Install and setup fixtures then run full CI tests
       if: ${{ matrix.env.TEST_TYPE == 'fixtures' }}
       run: |
-        sudo apt-get install -y --no-install-recommends slapd ldap-utils apparmor-utils
-        sudo systemctl stop slapd
-        sudo aa-complain /usr/sbin/slapd
 
-    # The sleep before stopping dovecot gives it time to produce the DH parameters file.
-    # Test dovecot instances don't run as root so if this file doesn't exist then there
-    # are permissions issues and the SSL instance of dovecot doesn't work
-    - name: Install fixture (dovecot imapd)
-      if: ${{ matrix.env.TEST_TYPE == 'fixtures' }}
-      run: |
-        sudo apt-get install -y --no-install-recommends dovecot-imapd
+        # Temporarily replace ucf (for config merge) with cp since it's
+        # terribly slow!
+        sudo sh -c 'echo "#!/bin/sh"          >  /usr/local/bin/ucf'
+        sudo sh -c 'echo "shift && cp -v \$@" >> /usr/local/bin/ucf'
+        sudo chmod +x /usr/local/bin/ucf
+        sudo apt-get install -y --no-install-recommends \
+          apparmor-utils \
+          dovecot-imapd \
+          exim4 \
+          redis-server redis-tools \
+          slapd ldap-utils
+        sudo rm -f /usr/local/bin/ucf
+
+        # Wait for Dovecot DH parameter creation before stopping the service
         while [ ! -f /var/lib/dovecot/ssl-parameters.dat ] ; do
             sleep 1
         done
-        sudo systemctl stop dovecot
-        sudo aa-complain /usr/sbin/dovecot
-
-    - name: Install fixture (exim)
-      if: ${{ matrix.env.TEST_TYPE == 'fixtures' }}
-      run: |
-        sudo apt-get install -y --no-install-recommends exim4
-        sudo systemctl stop exim4
+        sudo systemctl stop dovecot exim4 slapd
+        sudo aa-complain /usr/sbin/slapd
 
-    - name: Configure fixture (PostgreSQL)
-      if: ${{ matrix.env.TEST_TYPE == 'fixtures' }}
-      run: |
         export PG_VER=13
         sudo sh -c "echo host  all all 127.0.0.1/32 trust >  /etc/postgresql/$PG_VER/main/pg_hba.conf"
         sudo sh -c "echo local all all              trust >> /etc/postgresql/$PG_VER/main/pg_hba.conf"
-        sudo systemctl start postgresql
 
-    - name: Configure fixture (MySQL)
-      if: ${{ matrix.env.TEST_TYPE == 'fixtures' }}
-      run: |
-        sudo systemctl start mysql
+        sudo systemctl start mysql postgresql redis-server
+
         mysql -h 127.0.0.1 -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '';";
 
-    - name: Setup fixtures and run full CI tests
-      if: ${{ matrix.env.TEST_TYPE == 'fixtures' }}
-      run: |
         for i in \
             postgresql-setup.sh \
             imap-setup.sh \
@@ -308,7 +269,9 @@ jobs:
             echo "Calling $i"
             $script
         done
+
         make ci-test
+
       env:
         SMTP_TEST_SERVER: 127.0.0.1
         SMTP_TEST_SERVER_PORT: 2525