Skip to content

ci-tests-lock

ci-tests-lock #34

Workflow file for this run

# Reference:
# - https://github.com/actions/checkout
# - https://github.com/awalsh128/cache-apt-pkgs-action
# - https://github.com/conda-incubator/setup-miniconda
# - https://github.com/actions/upload-artifact
name: ci-tests-lock
on:
workflow_dispatch:
schedule:
# every day @ 00h03 except sunday (see ci-locks.yml)
- cron: "3 0 * * 1-6"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash -l {0}
jobs:
test-lock:
name: "test lock (${{ matrix.version }})"
runs-on: ubuntu-latest
env:
ENV_NAME: "ci-tests-lock"
PY_COLORS: "1"
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
version: ["py312"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "environment configure"
env:
# Maximum cache period (in weeks) before forcing a cache refresh.
CACHE_WEEKS: 2
run: |
echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV}
echo "PY_MAJOR=$(echo -n ${{ matrix.version }} | tail -c 3 | head -c 1)" >> ${GITHUB_ENV}
echo "PY_MINOR=$(echo -n ${{ matrix.version }} | tail -c 2)" >> ${GITHUB_ENV}
- name: "build lock (${{ matrix.version }})"
working-directory: requirements
env:
VTK_BUILD: " - vtk=*=qt_*"
run: |
python -c 'open("geovista.yml", "a").write("\n - python =${{ env.PY_MAJOR }}.${{ env.PY_MINOR }}\n${{ env.VTK_BUILD }}\n")'
pipx run conda-lock --channel conda-forge --kind explicit --file geovista.yml --platform linux-64
- name: "upload lock artifact"
uses: actions/upload-artifact@v4
with:
name: lock-artifacts-${{ github.job }}-${{ strategy.job-index }}
path: |
${{ github.workspace }}/requirements/conda-linux-64.lock
- name: "conda install"
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d
with:
miniforge-version: latest
activate-environment: ${{ env.ENV_NAME }}
environment-file: requirements/conda-linux-64.lock
use-only-tar-bz2: false
- name: "conda info"
run: |
conda info
conda list
- name: "cartopy cache"
uses: ./.github/workflows/composite/cartopy-cache
with:
cache_period: ${{ env.CACHE_PERIOD }}
env_name: ${{ env.ENV_NAME }}
- name: "apt cache"
uses: awalsh128/cache-apt-pkgs-action@a6c3917cc929dd0345bfb2d3feaf9101823370ad
with:
packages: libgl1-mesa-glx xvfb
version: 1.0
- name: "test lock (${{ matrix.version }})"
run: |
pip install --no-deps -e .
pytest --xvfb-backend xvfb --fail_extra_image_cache --generated_image_dir test_images
- name: "report failure"
if: failure()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TITLE="chore: conda lock test failure"
BODY=$(cat <<EOL
The \`${{ matrix.version }}\` tests for the latest resolved \`conda-lock\` environment have failed.
Please investigate GHA run-id [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
EOL
)
gh issue create --title "${TITLE}" --body "${BODY}" --label "bot" --label "new: issue" --repo "${{ github.repository }}"