commit:     6b3b62b5777677930b3ff9e00835f6b1c1e914aa
Author:     Aliaksei Urbanski <aliaksei.urbanski <AT> gmail <DOT> com>
AuthorDate: Wed Nov  8 15:01:37 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 13 06:20:51 2023 +0000
URL:        https://gitweb.gentoo.org/proj/pambase.git/commit/?id=6b3b62b5

Add a GitHub Actions workflow for tests

These changes enable tests on the GitHub side.
The implementation relies on Official Gentoo Docker images,
since I believe it's a better way to test Gentoo-specific packages.

Useful links:
  * https://www.gentoo.org/news/2020/07/04/official-docker.html
  * https://github.com/gentoo/gentoo-docker-images
  * https://github.com/docker/build-push-action
  * https://docs.docker.com/build/ci/github-actions/cache/

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .dockerignore               |  6 ++++++
 .github/workflows/tests.yml | 26 ++++++++++++++++++++++++++
 Dockerfile                  | 14 ++++++++++++++
 3 files changed, 46 insertions(+)

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..f502e63
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,6 @@
+.git/
+.github/
+stack/
+.dockerignore
+.gitignore
+Dockerfile

diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 0000000..652d733
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,26 @@
+name: Tests
+
+on:
+  push:
+  pull_request:
+    branches:
+      - master
+
+jobs:
+  tests:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v3
+      - name: Build the Docker image
+        uses: docker/build-push-action@v5
+        with:
+          context: .
+          cache-from: type=gha
+          cache-to: type=gha,mode=max
+          load: true
+          tags: pambase
+      - name: Run tox
+        run: docker run pambase

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..1d3d150
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,14 @@
+# based on https://github.com/gentoo/gentoo-docker-images
+
+FROM gentoo/portage:latest as portage
+FROM gentoo/stage3:latest
+
+COPY --from=portage /var/db/repos/gentoo /var/db/repos/gentoo
+
+ENV ACCEPT_KEYWORDS="~amd64"
+RUN emerge -qvu python:3.{10..12} dev-python/tox
+
+COPY . /usr/src/pambase
+WORKDIR /usr/src/pambase
+
+CMD tox --colored yes

Reply via email to