From 0f0f1c82fa8bbad2bd718ed6407e4def8a53334e Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@k1024.org>
Date: Sat, 5 Jun 2021 19:49:16 +0200
Subject: [PATCH] Add GitHub Actions workflow

---
 .github/workflows/ci.yml | 86 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 .github/workflows/ci.yml

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..0edae5c
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,86 @@
+on: [push]
+name: CI
+jobs:
+  build:
+    name: Build and test
+    runs-on: ${{ matrix.os }}
+    strategy:
+      matrix:
+        os: [ubuntu-latest]
+        python-version:
+          - '3.5'
+          - '3.6'
+          - '3.7'
+          - '3.8'
+          - '3.9'
+          - '3.10-dev'
+          - 'pypy-3.6'
+          - 'pypy-3.7'
+        include:
+          - os: ubuntu-18.04
+            python-version: '3.4'
+            installTyping: ${{ true }}
+      fail-fast: true
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v2
+        with:
+          python-version: ${{ matrix.python-version }}
+
+      - name: Cache pip
+        uses: actions/cache@v2
+        with:
+          # This path is specific to Ubuntu
+          path: ~/.cache/pip
+          # Look to see if there is a cache hit for the corresponding requirements file
+          key: v1-pip-${{ runner.os }}-${{ matrix.python-version }}
+          restore-keys: |
+            v1-pip-${{ runner.os }}
+            v1-pip-
+
+      - name: Install dependencies
+        run: |
+          pip install pytest
+          pip install codecov
+          sudo apt-get install -yy libacl1-dev
+
+      - name: Install typing for old Python
+        run: pip install typing
+        if: matrix.installTyping
+
+      - name: Build the code
+        run: python ./setup.py build_ext -i
+
+      - name: Run tests
+        run: python -m pytest tests
+
+      - name: Cleanup
+        run: make clean
+
+      - name: Re-build with coverage info
+        run: CFLAGS="-coverage" python ./setup.py build_ext -i
+
+      - name: Test with coverage
+        run: python -m pytest tests
+
+      - name: Upload coverage to Codecov
+        uses: codecov/codecov-action@v1
+        with:
+          #files: ./coverage1.xml,./coverage2.xml
+          #directory: ./coverage/reports/
+          #flags: unittests
+          #env_vars: OS,PYTHON
+          name: codecov-python-${{ matrix.python-version }}
+          #fail_ci_if_error: true
+          path_to_write_report: ./codecov-report.txt
+          #verbose: true
+
+      - name: Archive code coverage result
+        uses: 'actions/upload-artifact@v2'
+        with:
+          name: code-coverage-${{ matrix.os }}-${{ matrix.python-version }}
+          path: codecov-report.txt
-- 
2.39.5