git » summer » commit 0099b9c

test: Set up GitHub actions

author Alberto Bertogli
2023-08-23 19:50:20 UTC
committer Alberto Bertogli
2023-08-23 20:11:24 UTC
parent f0185c22cb4a481734c7d08f47b1f98f060a655e

test: Set up GitHub actions

This patch sets up GitHub actions to run our tests, and also run
govulncheck periodically.

.github/workflows/govulncheck.yaml +21 -0
.github/workflows/tests.yaml +33 -0
.gitignore +1 -0
README.md +4 -0

diff --git a/.github/workflows/govulncheck.yaml b/.github/workflows/govulncheck.yaml
new file mode 100644
index 0000000..3e92978
--- /dev/null
+++ b/.github/workflows/govulncheck.yaml
@@ -0,0 +1,21 @@
+name: "govulncheck"
+
+on:
+  push:
+    branches: [ "main", "next" ]
+  pull_request:
+    # The branches below must be a subset of the branches above
+    branches: [ "main", "next" ]
+  schedule:
+    - cron: '29 21 * * 6'
+
+jobs:
+  govulncheck:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    name: Run govulncheck
+    steps:
+      - id: govulncheck
+        uses: golang/govulncheck-action@v1
+        with:
+          check-latest: true
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
new file mode 100644
index 0000000..3b881e5
--- /dev/null
+++ b/.github/workflows/tests.yaml
@@ -0,0 +1,33 @@
+name: "tests"
+
+on:
+  push:
+    branches: [ "main", "next" ]
+  pull_request:
+    # The branches below must be a subset of the branches above
+    branches: [ "main", "next" ]
+  schedule:
+    - cron: '26 21 * * 6'
+
+jobs:
+  tests:
+    runs-on: ubuntu-latest
+    timeout-minutes: 5
+    steps:
+      - uses: actions/checkout@v3
+      - uses: actions/setup-go@v3
+        with:
+          go-version: ">=1.20"
+      - name: install dependencies
+        run: sudo apt install -y python3-cram
+
+      - name: test
+        run: ./test/cover.sh
+        timeout-minutes: 2
+
+      - name: upload coverage codecov
+        uses: codecov/codecov-action@v3
+        with:
+          files: test/.cover/cover.txt
+        env:
+          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 69efd0e..4b7d6b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 .*
 !.gitignore
+!.github
 summer
diff --git a/README.md b/README.md
index 8469fe8..c20d75c 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,10 @@ Checksums are written to/read from each file's extended attributes.
 
 ## Status
 
+[![tests](https://github.com/albertito/summer/actions/workflows/tests.yaml/badge.svg)](https://github.com/albertito/summer/actions/workflows/tests.yaml)
+[![codecov](https://codecov.io/gh/albertito/summer/graph/badge.svg?token=Nd3STeoyuk)](https://codecov.io/gh/albertito/summer)
+
+
 summer is still under active development. The user interface and on-disk
 format may change in backwards-incompatible ways.