From 1875b03152dfc3a15854daeeb8bb8997e9ad2642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Puerta=20Mart=C3=ADn?= <88980449+david96182@users.noreply.github.com> Date: Sat, 20 Apr 2024 04:33:40 -0400 Subject: [PATCH] Add GitHub Action workflow for tests and code coverage --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 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..8056cf8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: Test and Code Coverage + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Test with pytest + run: | + pytest --cov + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + flags: smart-tests + verbose: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}