]> eyrie.org Git - kerberos/krb5-strength.git/commitdiff
Switch to GitHub Actions
authorRuss Allbery <eagle@eyrie.org>
Sat, 16 May 2020 20:58:20 +0000 (13:58 -0700)
committerRuss Allbery <eagle@eyrie.org>
Sat, 16 May 2020 20:58:20 +0000 (13:58 -0700)
Replace the Travis-CI configuration with GitHub Actions and move
the code to install prerequisites and run the tests into files in
the ci directory.

.github/workflows/build.yaml [new file with mode: 0644]
.travis.yml [deleted file]
Makefile.am
ci/README [new file with mode: 0644]
ci/install [new file with mode: 0755]
ci/test [new file with mode: 0755]

diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
new file mode 100644 (file)
index 0000000..1950ff5
--- /dev/null
@@ -0,0 +1,42 @@
+name: build
+
+on:
+  push:
+    branches-ignore:
+      - "debian/**"
+      - "pristine-tar"
+      - "ubuntu/**"
+      - "upstream/**"
+    tags:
+      - "release/*"
+  pull_request:
+    branches:
+      - master
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+
+    env:
+      AUTHOR_TESTING: 1
+      C_TAP_VERBOSE: 1
+
+    strategy:
+      fail-fast: false
+      matrix:
+        compiler:
+          - "gcc"
+          - "clang"
+        kerberos:
+          - "mit"
+          - "heimdal"
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: install
+        run: sudo ci/install
+      - name: test
+        run: ci/test
+        env:
+          COMPILER: ${{ matrix.compiler }}
+          KERBEROS: ${{ matrix.kerberos }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index d30d2e2..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-language: c
-compiler:
-  - gcc
-dist: trusty
-sudo: required
-
-before_install:
-  - sudo apt-get update -qq
-  - sudo apt-get install libcdb-dev libdb-file-lock-perl libcrypt-pbkdf2-perl libdbd-sqlite3-perl libdbi-perl libgetopt-long-descriptive-perl libipc-run-perl libjson-perl libkrb5-dev libperl6-slurp-perl libreadonly-perl libsqlite3-dev libtest-minimumversion-perl libtest-perl-critic-perl libtest-pod-perl libtest-strict-perl pkg-config sqlite tinycdb
-env: AUTHOR_TESTING=1
-script: ./bootstrap && ./configure && make warnings && make check
-
-branches:
-  only:
-    - master
index 31e30a8523c8d0280ea77f89bc15b73ca9e207c3..747984dac2b3cc170df2f040233805f90f8cbc62 100644 (file)
@@ -8,12 +8,13 @@
 # See LICENSE for licensing terms.
 
 ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = .clang-format .gitignore .travis.yml README.md LICENSE        \
-       bootstrap cracklib/HISTORY cracklib/LICENCE cracklib/README         \
-       cracklib/genrules.pl cracklib/mkdict docs/krb5-strength.5.in        \
-       docs/krb5-strength.pod docs/metadata tests/README tests/TESTS       \
-       tests/data/krb5.conf tests/data/make-krb5-conf tests/data/passwords \
-       tests/data/perl.conf tests/data/perlcriticrc tests/data/perltidyrc  \
+EXTRA_DIST = .clang-format .github .gitignore README.md LICENSE bootstrap   \
+       ci/README ci/install ci/test cracklib/HISTORY cracklib/LICENCE      \
+       cracklib/README cracklib/genrules.pl cracklib/mkdict                \
+       docs/krb5-strength.5.in docs/krb5-strength.pod docs/metadata        \
+       tests/README tests/TESTS tests/data/krb5.conf                       \
+       tests/data/make-krb5-conf tests/data/passwords tests/data/perl.conf \
+       tests/data/perlcriticrc tests/data/perltidyrc                       \
        tests/data/valgrind.supp tests/data/wordlist                        \
        tests/data/wordlist.cdb tests/data/wordlist.sqlite                  \
        tests/docs/pod-spelling-t tests/docs/pod-t tests/perl/critic-t      \
diff --git a/ci/README b/ci/README
new file mode 100644 (file)
index 0000000..8b2dde6
--- /dev/null
+++ b/ci/README
@@ -0,0 +1,2 @@
+The files in this directory are used for CI testing.  ci/install installs
+the prerequisite packages, and ci/test runs the tests.
diff --git a/ci/install b/ci/install
new file mode 100755 (executable)
index 0000000..ddac22a
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Install packages for integration tests.
+#
+# This script is normally run via sudo in a test container or VM, such as via
+# GitHub Actions.
+#
+# Perl::Tidy, Perl::Critic, and Test::Perl::Critic are installed separately to
+# get the latest version, since they sometimes change formatting and style
+# rules compared to the version in Ubuntu.  Test::MinimumVersion has to be
+# included since it installs Perl::Critic.
+#
+# Allow the installation of Perl::Critic and Test::Perl::Critic to fail, since
+# sometimes the versions on CPAN won't install.  (We'll just skip the test if
+# it won't install.)
+#
+# Copyright 2015-2020 Russ Allbery <eagle@eyrie.org>
+#
+# SPDX-License-Identifier: MIT
+
+set -eux
+
+# Install packages.
+apt-get update -qq
+apt-get install aspell cpanminus cppcheck heimdal-multidev libcdb-dev    \
+        libdb-file-lock-perl libcrypt-pbkdf2-perl libdbd-sqlite3-perl    \
+        libdbi-perl libgetopt-long-descriptive-perl libipc-run-perl      \
+        libjson-perl libkrb5-dev libperl6-slurp-perl libreadonly-perl    \
+        libsqlite3-dev libtest-minimumversion-perl libtest-pod-perl      \
+        libtest-spelling-perl libtest-strict-perl pkg-config perl sqlite \
+        tinycdb valgrind
+
+# Dependencies for Perl tests.
+cpanm Perl::Tidy
+cpanm Perl::Critic         || true
+cpanm Test::MinimumVersion || true
+cpanm Test::Perl::Critic   || true
diff --git a/ci/test b/ci/test
new file mode 100755 (executable)
index 0000000..cd75a5d
--- /dev/null
+++ b/ci/test
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# Run tests for continuous integration.
+#
+# This script is normally run in a test container or VM, such as via GitHub
+# Actions.
+#
+# Copyright 2015-2020 Russ Allbery <eagle@eyrie.org>
+#
+# SPDX-License-Identifier: MIT
+
+set -eux
+
+# Normally, COMPILER and KERBEROS are set based on the CI matrix, but provide
+# a default in case someone runs this test by hand.
+COMPILER="${COMPILER:-gcc}"
+KERBEROS="${KERBEROS:-mit}"
+
+# Build everything.
+./bootstrap
+if [ "$KERBEROS" = 'heimdal' ]; then
+    ./configure CC="$COMPILER" PATH_KRB5_CONFIG=/usr/bin/krb5-config.heimdal
+else
+    ./configure CC="$COMPILER"
+fi
+make warnings
+
+# Run tests.
+make check