]> git.ipfire.org Git - thirdparty/mtr.git/commitdiff
Github actions added to perform lint and compile 481/head
authordarless <3382617+darless@users.noreply.github.com>
Tue, 11 Jul 2023 16:18:33 +0000 (11:18 -0500)
committerdarless <3382617+darless@users.noreply.github.com>
Wed, 12 Jul 2023 17:48:34 +0000 (12:48 -0500)
In the test folder, there was lint.sh, but I think flake8 is a better
tool.

Added a compile job for linux, this runs compilation as defined in
the README, runs a sample mtr and runs cmdparse.py test. Need
documentation on what other tests to run and whether to include the
testing in tox instead of running them individually.

Not adding in this PR support for cygwin or freebsd, as that will need
investigation on how to run.

Minor:
- Fixed a typo in configure.ac that used ---- vs -- for a flag option.

.flake8 [new file with mode: 0644]
.github/workflows/test.yaml [new file with mode: 0644]
.gitignore
configure.ac
test/probe.py

diff --git a/.flake8 b/.flake8
new file mode 100644 (file)
index 0000000..ed16194
--- /dev/null
+++ b/.flake8
@@ -0,0 +1,14 @@
+[flake8]
+
+select =
+    E902,
+    E999,
+    S,
+    F,
+
+ignore =
+    F821
+
+per-file-ignores =
+    test/*: S603,S404
+
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
new file mode 100644 (file)
index 0000000..c47f170
--- /dev/null
@@ -0,0 +1,35 @@
+name: Test compilation
+on: [push, pull_request]
+jobs:
+  lint:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
+        with:
+          python-version: 3.9
+      - name: Install flake8
+        run: pip3 install flake8==3.9.2 flake8-bandit==2.1.2 bandit==1.7.2
+      - name: Run flake8
+        run: python3 -m flake8 .
+  compile-linux:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/setup-python@v4
+        with:
+          python-version: 3.9
+      - uses: egor-tensin/setup-gcc@v1.3
+        with:
+          version: latest
+          platform: x64
+      - name: Bootstrap
+        run: ./bootstrap.sh
+      - name: Configure
+        run: ./configure --without-gtk --without-jansson
+      - name: Make
+        run: make -j $(nproc)
+      - name: Run sample mtr against 1.1.1.1
+        run: ./mtr --report --report-cycles 1 -m 1 1.1.1.1
+      - name: Run test - cmdparse.py
+        run: python3 ./test/cmdparse.py
\ No newline at end of file
index d3d1068ece54d290602d760f518132a9e9ee497c..887cc01b03b7353901c2a4c2f1b6ea8fea8b3d93 100644 (file)
@@ -42,3 +42,4 @@ stamp-h1*
 /test/*.py.trs
 
 /mtr-*.tar.gz
+*.swp
index 286ede60b485a99565ee1177e436328a6c60e4b4..cc07d817cbd56847d4abb18eb4cbcbe04b06d225 100644 (file)
@@ -25,7 +25,7 @@ m4_ifndef([PKG_CHECK_MODULES], [m4_defun([PKG_CHECK_MODULES], [AC_MSG_ERROR(
 [Could not locate the pkg-config autoconf macros.  These are usually located
 in /usr/share/aclocal/pkg.m4.  If your macros are in a different location,
 try setting the environment variable ACLOCAL_OPTS="-I/other/macro/dir"
-before running ./bootstrap.sh again, or configure --without-gtk ----without-jansson ])])
+before running ./bootstrap.sh again, or configure --without-gtk --without-jansson ])])
 ])
 PKG_PROG_PKG_CONFIG
 
index df5f49678e59308e097be49ec0942daccebfceed..30acd453e58fad9b76528163b81ab0c9a7b0f067 100755 (executable)
@@ -263,7 +263,6 @@ class TestProbeICMPv4(mtrpacket.MtrPacketTest):
         required_success = int(loop_count * 0.90)
         self.assertGreaterEqual(success_count, required_success)
 
-
 class TestProbeICMPv6(mtrpacket.MtrPacketTest):
     '''Test sending probes using IP version 6'''