Skip to content

Test environments

Test environments #501

Workflow file for this run

name: Test environments
on:
push:
pull_request:
branches:
- main
# Run daily at 1:23 UTC
schedule:
- cron: '23 1 * * *'
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Needed for micromamba pickup
defaults:
run:
shell: bash -l {0}
jobs:
scikit-hep:
runs-on: ${{ matrix.os }}
# On push events run the CI only on main by default
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.12']
if: >-
github.event_name != 'push'
|| (github.event_name == 'push' && github.ref == 'refs/heads/main')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Build lock file
run: |
uv pip compile \
--generate-hashes \
--output-file requirements.lock \
--python-version ${{ matrix.python-version }} \
scikit-hep/${{ matrix.python-version }}/requirements.txt
- name: Install micromamba and conda-lock
uses: mamba-org/setup-micromamba@v2
with:
environment-name: conda-lock
create-args: >-
python=${{ matrix.python-version }}
- name: Install conda-lock from main
run: |
pipx install --force 'git+https://github.com/conda/conda-lock@main'
- name: Build conda-lock lock file
run: |
conda-lock \
--file scikit-hep/${{ matrix.python-version }}/environment.yml \
--lockfile conda-lock.yml
- name: Upload lock files
uses: actions/upload-artifact@v4
with:
name: scikit-hep-${{ matrix.python-version }}
path: |
requirements.lock
conda-lock.yml
iris-hep:
runs-on: ${{ matrix.os }}
# On push events run the CI only on main by default
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.12']
if: >-
github.event_name != 'push'
|| (github.event_name == 'push' && github.ref == 'refs/heads/main')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Build lock file
run: |
uv pip compile \
--generate-hashes \
--output-file requirements.lock \
--python-version ${{ matrix.python-version }} \
iris-hep/${{ matrix.python-version }}/requirements.txt
- name: Install micromamba and conda-lock
uses: mamba-org/setup-micromamba@v2
with:
environment-name: conda-lock
create-args: >-
python=${{ matrix.python-version }}
- name: Install conda-lock from main
run: |
pipx install --force 'git+https://github.com/conda/conda-lock@main'
- name: Build conda-lock lock file
run: |
conda-lock \
--file iris-hep/${{ matrix.python-version }}/environment.yml \
--lockfile conda-lock.yml
- name: Upload lock files
uses: actions/upload-artifact@v4
with:
name: iris-hep-${{ matrix.python-version }}
path: |
requirements.lock
conda-lock.yml
iris-hep-rc:
runs-on: ${{ matrix.os }}
# On push events run the CI only on main by default
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.12']
if: >-
github.event_name != 'push'
|| (github.event_name == 'push' && github.ref == 'refs/heads/main')
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pip-tools
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"
- name: Build lock file
run: |
uv pip compile \
--generate-hashes \
--prerelease if-necessary \
--output-file requirements.lock \
--python-version ${{ matrix.python-version }} \
iris-hep-rc/${{ matrix.python-version }}/requirements.txt
- name: Install micromamba and conda-lock
uses: mamba-org/setup-micromamba@v2
with:
environment-name: conda-lock
create-args: >-
python=${{ matrix.python-version }}
- name: Install conda-lock from main
run: |
pipx install --force 'git+https://github.com/conda/conda-lock@main'
- name: Build conda-lock lock file
run: |
conda-lock \
--file iris-hep-rc/${{ matrix.python-version }}/environment.yml \
--lockfile conda-lock.yml
- name: Upload lock files
uses: actions/upload-artifact@v4
with:
name: iris-hep-rc-${{ matrix.python-version }}
path: |
requirements.lock
conda-lock.yml
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: [scikit-hep, iris-hep, iris-hep-rc]
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Create site directory structure
run: |
cp -r scikit-hep _site/
cp -r iris-hep _site/
cp -r iris-hep-rc _site/
- uses: actions/download-artifact@v4
with:
name: scikit-hep-3.8
path: '_site/scikit-hep/3.8/'
- uses: actions/download-artifact@v4
with:
name: scikit-hep-3.12
path: '_site/scikit-hep/3.12/'
- uses: actions/download-artifact@v4
with:
name: iris-hep-3.12
path: '_site/iris-hep/3.12/'
- uses: actions/download-artifact@v4
with:
name: iris-hep-3.8
path: '_site/iris-hep/3.8/'
- uses: actions/download-artifact@v4
with:
name: iris-hep-rc-3.12
path: '_site/iris-hep-rc/3.12/'
- uses: actions/download-artifact@v4
with:
name: iris-hep-rc-3.8
path: '_site/iris-hep-rc/3.8/'
- name: Add deploy time in UTC to site
run: |
mkdir -p _site/metadata
date -u +"%Y-%m-%d %H:%M %Z" > _site/metadata/deploy-time.txt
- name: Check site structure
run: |
tree _site
- name: Fix permissions
run: |
chmod -c -R +rX "_site/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4