diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..12ea157 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,5 @@ +name: Docker +on: + push: + tags: + - '*' \ No newline at end of file diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml new file mode 100644 index 0000000..a2c8744 --- /dev/null +++ b/.github/workflows/pypi.yaml @@ -0,0 +1,33 @@ +name: PyPI +on: + push: + tags: + - '*' + +env: + PYPI_FROM_GITHUB: 1 + +jobs: + build: + name: Build & Push PyPI package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 + - uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 + with: + python-version: '3.10.x' + cache: 'pip' + cache-dependency-path: '**/requirements*.txt' + - run: pip install -r requirements-dev.txt + - name: Extract tag name + id: tag + run: echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3) + - name: Update version in setup.py + run: >- + sed -i "s/{{PKG_VERSION}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py + - name: Build a binary wheel + run: make dist + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..e17245d --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,69 @@ +name: Tests +on: + workflow_dispatch: + pull_request: + paths: + - "tracker_exporter/**" + - "tests/**" + branches: + - master + push: + paths: + - "tracker_exporter/**" + - "tests/**" + branches: + - master + schedule: + - cron: '20 4 * * 6' + +jobs: + pytest: + name: pytest + runs-on: ${{matrix.os}} + strategy: + matrix: + python-version: + - "3.10" + os: + - ubuntu-latest + - windows-latest + - macos-latest + fail-fast: false + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: 'pip' + cache-dependency-path: '**/requirements*.txt' + - name: Install dependencies + run: | + python -W ignore -m pip install --upgrade pip + python -W ignore -m pip install -U pytest-cov + python -W ignore -m pip install -r requirements.txt + python -W ignore -m pip install -r requirements-dev.txt + python -W ignore -m pip install pytest-xdist[psutil] + + - name: Test with pytest + run: | + pytest -vv --cov=tracker_exporter --cov-append -n auto --junit-xml=.test_report.xml + env: + JOB_INDEX: ${{ strategy.job-index }} + + - name: Test Summary + id: test_summary + uses: test-summary/action@v2.1 + if: always() # always run, even if tests fail + with: + paths: | + .test_report.xml + + - name: Submit coverage + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + env_vars: OS,PYTHON + name: ${{ matrix.os }}-${{ matrix.python-version }} + fail_ci_if_error: true \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_config.py b/tests/test_config.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_etl.py b/tests/test_etl.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_helpers.py b/tests/test_helpers.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_state.py b/tests/test_state.py new file mode 100644 index 0000000..e69de29