Skip to content

Merge pull request #687 from ssec/dependabot/github_actions/pypa/gh-a… #1037

Merge pull request #687 from ssec/dependabot/github_actions/pypa/gh-a…

Merge pull request #687 from ssec/dependabot/github_actions/pypa/gh-a… #1037

Workflow file for this run

name: CI
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
# https://docs.github.com/en/developers/webhooks-and-events/events/github-event-types#pullrequestevent
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.type }}
cancel-in-progress: true
on: [push, pull_request, workflow_dispatch]
env:
CACHE_NUMBER: 1
jobs:
# build website
website:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
lfs: true
- name: Prepare System Environment
run: |
# opengl system libraries
sudo apt-get update
# Additional latex dependencies
sudo apt-get -y install texlive-xetex texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra latexmk
sudo apt-get -y install dvipng
- name: Setup Conda Environment
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
python-version: "3.11"
activate-environment: test-environment
- name: Set cache environment variables
shell: bash -l {0}
run: |
echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
CONDA_PREFIX=$(python -c "import sys; print(sys.prefix)")
echo "CONDA_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ${{ env.CONDA_PREFIX }}
key: ubuntu-latest-3.10-conda-${{ hashFiles('continuous_integration/environment.yaml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: mamba env update -n test-environment -f continuous_integration/environment.yaml
if: steps.cache.outputs.cache-hit != 'true'
- name: Install Polar2Grid
shell: bash -l {0}
run: |
pip install --no-deps -e .
- name: Build Polar2Grid Website
shell: bash -l {0}
run: |
cd doc
make clean
make html SPHINXOPTS="-W --keep-going"
- name: Build Geo2Grid Website
shell: bash -l {0}
run: |
cd doc
make clean
make html POLAR2GRID_DOC="geo" SPHINXOPTS="-W --keep-going"
- name: Build Polar2Grid PDF
shell: bash -l {0}
run: |
cd doc
make clean
make latexpdf SPHINXOPTS="-W --keep-going"
- name: Build Geo2Grid PDF
shell: bash -l {0}
run: |
cd doc
make clean
make latexpdf POLAR2GRID_DOC="geo" SPHINXOPTS="-W --keep-going"
test:
name: Tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ["windows-latest", "ubuntu-latest", "macos-latest"]
python-version: ["3.11"]
env:
PYTHON_VERSION: ${{ matrix.python-version }}
OS: ${{ matrix.os }}
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup Conda Environment
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
python-version: ${{ matrix.python-version }}
activate-environment: test-environment
- name: Set cache environment variables
shell: bash -l {0}
run: |
echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
CONDA_PREFIX=$(python -c "import sys; print(sys.prefix)")
echo "CONDA_PREFIX=$CONDA_PREFIX" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: ${{ env.CONDA_PREFIX }}
key: ${{ matrix.os }}-${{matrix.python-version}}-conda-${{ hashFiles('continuous_integration/environment.yaml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
run: mamba env update -n test-environment -f continuous_integration/environment.yaml
if: steps.cache.outputs.cache-hit != 'true'
- name: Install Polar2Grid on non-Windows
shell: bash -l {0}
run: |
pip install --no-deps -e .
if: runner.os != 'Windows'
- name: Run unit tests on non-Windows
shell: bash -l {0}
run: |
pytest --cov=polar2grid polar2grid/tests --cov-report=
polar2grid --help
geo2grid --help
if: runner.os != 'Windows'
- name: Install Polar2Grid on Windows
shell: powershell
run: |
pip install --no-deps -e .
if: runner.os == 'Windows'
- name: Run help usage tests on Windows
shell: powershell
# Windows CI doesn't have enough memory for the tests
# pytest --cov=polar2grid polar2grid/tests --cov-report=
# if ($LASTEXITCODE) { exit $LASTEXITCODE }
run: |
polar2grid --help
if ($LASTEXITCODE) { exit $LASTEXITCODE }
geo2grid --help
if: runner.os == 'Windows'
- name: Coveralls Parallel
uses: AndreMiras/coveralls-python-action@develop
with:
flag-name: run-${{ matrix.test_number }}
parallel: true
if: runner.os == 'Linux'
coveralls:
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
parallel-finished: true