Remove newly pure Python package gribscan #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
release: | |
branch: main | |
types: [released] | |
jobs: | |
build-pyodide: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Check the Pyodide version | |
run: | | |
echo "PYODIDE_SHA_SHORT=$(git submodule status pyodide | cut -c 2-8)" >> $GITHUB_ENV | |
- name: Cache the Pyodide build | |
uses: actions/cache@v4 | |
with: | |
path: ./pyodide | |
key: pyodide-${{ github.ref }}-${{ env.PYODIDE_SHA_SHORT }} | |
restore-keys: | | |
pyodide-${{ github.ref }}-${{ env.PYODIDE_SHA_SHORT }} | |
pyodide-${{ github.ref }} | |
pyodide-refs/heads/main | |
- name: Ensure that the Pyodide source files are fresh | |
run: | | |
cd pyodide | |
git status | |
git diff --name-only | xargs git checkout -- | |
git clean -df | |
echo ====== | |
git status | |
- name: Cache the Pyodide Docker image | |
uses: ScribeMD/docker-cache@0.5.0 | |
with: | |
key: docker-pyodide-${{ hashFiles('pyodide/Dockerfile') }} | |
- name: Discover the cached Pyodide Docker image | |
run: echo "PYODIDE_DOCKER_IMAGE=$(docker images climet-eu/pyodide --format '{{.ID}}')" >> $GITHUB_ENV | |
- name: Build the Pyodide Docker image | |
if: ${{ env.PYODIDE_DOCKER_IMAGE == '' }} | |
run: | | |
cd pyodide | |
docker build -t climet-eu/pyodide . | |
echo "PYODIDE_DOCKER_IMAGE=$(docker build . -q)" >> $GITHUB_ENV | |
- name: Build Pyodide and all required packages | |
run: | | |
cd pyodide | |
./run_docker \ | |
--non-interactive \ | |
PYODIDE_PACKAGES="$(cat ../venv/packages.txt | paste -sd "," -)" \ | |
make | |
- name: Clean up the Pyodide build | |
run: | | |
python tools/clean-dist.py pyodide/dist | |
cd pyodide | |
find . -name jupyter-lite.json -delete | |
find . -name jupyter_lite_config.json -delete | |
rm -f dist/tsconfig.tsbuildinfo | |
mkdir -p packages/numpy/build | |
touch packages/numpy/build/ls-success | |
ls -d packages/*/build/* | xargs rm -r | |
- name: Upload the pyodide-lock.json artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pyodide-lock.json | |
path: pyodide/dist/pyodide-lock.json | |
retention-days: 1 | |
- name: Upload the Pyodide distribution artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pyodide | |
path: pyodide/dist | |
retention-days: 1 | |
- name: Remove the uploaded Pyodide distribution | |
run: rm -rf pyodide/dist | |
build-pypa: | |
runs-on: ubuntu-latest | |
needs: build-pyodide | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Download the pyodide-lock.json artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pyodide-lock.json | |
path: pyodide/dist | |
- name: Extract the PyPa simple repository API | |
run: python tools/pypa-simple.py pypa/simple ../../../static/pyodide/ | |
- name: Upload the PyPa repository artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pypa | |
path: pypa | |
retention-days: 1 | |
build-lock: | |
runs-on: ubuntu-latest | |
needs: [build-pyodide, build-pypa] | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Cache the Pyodide Docker image | |
uses: ScribeMD/docker-cache@0.5.0 | |
with: | |
key: docker-pyodide-${{ hashFiles('pyodide/Dockerfile') }} | |
read-only: true | |
- name: Discover the cached Pyodide Docker image | |
run: echo "PYODIDE_DOCKER_IMAGE=$(docker images climet-eu/pyodide --format '{{.ID}}')" >> $GITHUB_ENV | |
- name: Download the Pyodide distribution artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pyodide | |
path: pyodide/static/pyodide | |
- name: Download the PyPa repository artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pypa | |
path: pyodide/pypa | |
- name: Extract the PyPi-enabled pyodide-lock.json | |
run: | | |
cp venv/requirements.txt pyodide/my-requirements.txt | |
cp tools/pypi-lock.mjs pyodide/static/pyodide/pypi-lock.mjs | |
cd pyodide | |
./run_docker --non-interactive python -m http.server "&" node static/pyodide/pypi-lock.mjs my-requirements.txt pyodide-lock.json | |
- name: Upload the PyPi pyodide-lock.json artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pypi-pyodide-lock.json | |
path: pyodide/pyodide-lock.json | |
retention-days: 1 | |
check-venv: | |
runs-on: ubuntu-latest | |
needs: build-lock | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12.7" | |
- name: Install PyYAML | |
run: pip install PyYAML | |
- name: Download the PyPi pyodide-lock.json artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pypi-pyodide-lock.json | |
path: pyodide/dist | |
- name: Extract the requirements from the Pyodide build | |
run: python tools/requirements.py | |
- name: Check that the venv requirements are up-to-date | |
run: git diff --exit-code ./venv/ | |
- name: Check the requirements.txt file | |
continue-on-error: ${{ github.event_name != 'release' }} | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install --upgrade pip | |
pip install -r venv/requirements.txt --dry-run --ignore-installed | |
deactivate | |
rm -rf .venv | |
- name: Check the validity of the constraints.txt and requirements.in files | |
continue-on-error: ${{ github.event_name != 'release' }} | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install --upgrade pip | |
pip install -r venv/constraints.txt -r venv/requirements.in --dry-run --ignore-installed | |
deactivate | |
rm -rf .venv | |
build-jupyterlite: | |
runs-on: ubuntu-latest | |
needs: [build-pyodide, build-pypa, build-lock] | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12.7" | |
- name: Install the dependencies | |
run: | | |
pip install -r requirements.txt | |
- name: Prepare the JupyterLite input files | |
run: | | |
mkdir -p files | |
cp ./README.md files/ | |
cp venv/constraints.txt venv/requirements.in venv/requirements.txt files/ | |
mkdir -p static | |
- name: Download the Pyodide distribution artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pyodide | |
path: static/pyodide | |
- name: Download the PyPi pyodide-lock.json artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pypi-pyodide-lock.json | |
path: static/pyodide | |
- name: Build the JupyterLite site | |
run: | | |
jupyter lite build --output-dir staging | |
cp static/favicons/favicon.ico staging/ | |
find staging/ -name favicon.ico | xargs -L1 cp -f static/favicons/favicon.ico | |
- name: Download the PyPa repository artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: pypa | |
path: staging/pypa | |
- name: Upload the JupyterLite artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jupyterlite | |
path: staging | |
retention-days: 1 | |
deploy: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: [build-jupyterlite, check-venv] | |
steps: | |
- name: Get the current branch name | |
uses: tj-actions/branch-names@v8 | |
id: branch | |
- name: Compute the current version name | |
run: echo "CLIMETLAB_VERSION=${{ steps.branch.outputs.current_branch || steps.branch.outputs.tag }}" >> $GITHUB_ENV | |
- name: Checkout the previous dist branch | |
uses: actions/checkout@v4 | |
with: | |
ref: dist | |
path: dist | |
continue-on-error: ${{ github.event_name != 'release' }} | |
- name: Prepare merging the different dist versions | |
run: | | |
mkdir -p dist | |
rm -rf dist/${{ env.CLIMETLAB_VERSION }} | |
- name: Download the JupyterLite artifact into the dist | |
uses: actions/download-artifact@v4 | |
with: | |
name: jupyterlite | |
path: dist/${{ env.CLIMETLAB_VERSION }} | |
- name: Deploy to dist branch | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_branch: dist | |
publish_dir: ./dist | |
keep_files: false | |
force_orphan: true | |
cleanup: | |
runs-on: ubuntu-latest | |
needs: deploy | |
if: always() | |
steps: | |
- name: Delete the build artifacts | |
uses: geekyeggo/delete-artifact@v5 | |
with: | |
name: | | |
pyodide | |
pypa | |
jupyterlite | |
failOnError: false |