diff --git a/.github/workflows/build-and-release.yaml b/.github/workflows/build-and-release.yaml index eb7796c..b39a0f6 100644 --- a/.github/workflows/build-and-release.yaml +++ b/.github/workflows/build-and-release.yaml @@ -7,13 +7,14 @@ on: - '[0-9]+.[0-9]+.[0-9]+b[0-9]+' jobs: - create_release: name: Create Release runs-on: ubuntu-latest + outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} job_status: ${{ job.status }} + steps: - name: Checkout project uses: actions/checkout@v3 @@ -30,7 +31,6 @@ jobs: prerelease: ${{ contains(github.ref_name ,'b') }} build_and_test: - name: Test and build artefacts needs: create_release outputs: @@ -55,8 +55,8 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - cache: 'pip' - cache-dependency-path: '**/pyproject.toml' + cache: "pip" + cache-dependency-path: "./pyproject.toml" - name: Install system dependencies run: | @@ -116,7 +116,6 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v3 with: name: dist-py3 @@ -162,11 +161,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout project on gh-pages uses: actions/checkout@v3 with: - ref: 'gh-pages' + ref: "gh-pages" token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/download-artifact@v3 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..8560c37 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,68 @@ +name: Tests + +on: + push: + branches: + - develop + - master + pull_request: + branches: + - develop + - master + +jobs: + unit-test: + name: "🎳 Unit tests" + strategy: + fail-fast: false + matrix: + os: + - ubuntu-20.04 + - ubuntu-22.04 + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + + runs-on: ${{ matrix.os }} + steps: + - name: Get source code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + cache-dependency-path: "pyproject.toml" + + - name: Install system dependencies + run: | + sudo apt update + sudo apt install gdal-bin libgdal-dev + export CPLUS_INCLUDE_PATH=/usr/include/gdal + export C_INCLUDE_PATH=/usr/include/gdal + gdal-config --version + sudo apt install python3-rados python3-gdal + python3 -c "import rados; print(rados.Rados().version())" + + - name: Install project requirements + run: | + python -m pip install -U pip setuptools wheel + python -m pip install -e .[test] + python -m pip install GDAL=="`gdal-config --version`.*" + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3.1.4 + + - name: Run unit tests + run: | + coverage run -m pytest + coverage report -m + + - uses: actions/upload-artifact@v3 + with: + name: python_wheel + path: dist/* + if-no-files-found: error