-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from OpenCOMPES/update_python_and_move_package…
…_to_uv Update python and move package to uv
- Loading branch information
Showing
37 changed files
with
392 additions
and
4,833 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,53 +4,46 @@ on: | |
push: | ||
branches: [ main ] | ||
paths: | ||
- specsanalyzer/**/* | ||
- specsscan/**/* | ||
- src/specsanalyzer/**/* | ||
- src/specsscan/**/* | ||
- tutorial/** | ||
- .github/workflows/documentation.yml | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
env: | ||
UV_SYSTEM_PYTHON: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Check out repo and set up Python | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
# Check out repo and set up Python | ||
- uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
fetch-depth: 0 | ||
|
||
# see https://stackoverflow.com/questions/57612428/cloning-private-github-repository-within-organisation-in-actions and https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key | ||
- name: checkout test data | ||
- name: Fetch test data | ||
run: | | ||
eval `ssh-agent -s` | ||
ssh-add - <<< '${{ secrets.TEST_DATA_ACCESS_KEY }}' | ||
git submodule sync --recursive | ||
git submodule update --init --recursive | ||
git submodule update --init --recursive --jobs=4 | ||
# Use cached python and dependencies, install poetry | ||
- name: "Setup Python, Poetry and Dependencies" | ||
uses: packetcoders/action-setup-cache-python-poetry@main | ||
# Setup python | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.8 | ||
poetry-version: 1.8.5 | ||
python-version: "3.10" | ||
|
||
- name: Install dependencies | ||
run: | | ||
curl -LsSf https://astral.sh/uv/install.sh | sh | ||
- name: Install notebook dependencies | ||
run: poetry install -E notebook --with docs | ||
- name: Install package | ||
run: | | ||
uv pip install ".[docs,notebook]" | ||
- name: Install pandoc | ||
run: | | ||
|
@@ -61,37 +54,80 @@ jobs: | |
- name: copy tutorial files to docs | ||
run: | | ||
cp -r $GITHUB_WORKSPACE/tutorial $GITHUB_WORKSPACE/docs/ | ||
cp -r $GITHUB_WORKSPACE/specsscan/config $GITHUB_WORKSPACE/docs/specsscan/ | ||
mkdir $GITHUB_WORKSPACE/docs/tests | ||
cp -r $GITHUB_WORKSPACE/tests/data $GITHUB_WORKSPACE/docs/tests/ | ||
# To be included later | ||
# - name: Cache docs build | ||
# id: cache-docs | ||
# uses: actions/cache@v3 | ||
# with: | ||
# path: $GITHUB_WORKSPACE/_build | ||
# key: ${{ runner.os }}-docs | ||
mkdir -p $GITHUB_WORKSPACE/docs/src/specsscan | ||
cp -r $GITHUB_WORKSPACE/src/specsscan/config $GITHUB_WORKSPACE/docs/src/specsscan | ||
- name: build Sphinx docs | ||
run: poetry run sphinx-build -b html $GITHUB_WORKSPACE/docs $GITHUB_WORKSPACE/_build | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
run: sphinx-build -b html $GITHUB_WORKSPACE/docs $GITHUB_WORKSPACE/_build | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
path: '_build' | ||
name: sphinx-docs | ||
path: _build | ||
|
||
# Deployment job | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
# this job pushes the built documentation to the docs repository | ||
push: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 | ||
- name: Checkout docs repo | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: ${{ github.repository_owner }}/docs | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
path: 'docs-repo' | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Setup SSH | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_DOCS_DEPLOY_KEY }} | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: sphinx-docs | ||
path: sphinx-docs | ||
|
||
- name: Determine version folder | ||
id: version-folder | ||
run: | | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
VERSION=${GITHUB_REF#refs/tags/} | ||
echo "folder=specsanalyzer/$VERSION" >> $GITHUB_OUTPUT | ||
rm docs-repo/specsanalyzer/stable | ||
ln -s -r docs-repo/specsanalyzer/$VERSION docs-repo/specsanalyzer/stable | ||
elif [[ $GITHUB_REF == refs/heads/main ]]; then | ||
echo "folder=specsanalyzer/latest" >> $GITHUB_OUTPUT | ||
else | ||
echo "folder=specsanalyzer/develop" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Update switcher.json | ||
run: | | ||
VERSION=`grep "<title>" sphinx-docs/index.html | sed -n 's/.*specsanalyzer \(.*\) documentation.*/\1/p'` | ||
echo "python docs-repo/specsanalyzer/update_switcher.py docs-repo/specsanalyzer/switcher.json $GITHUB_REF $VERSION" | ||
python docs-repo/specsanalyzer/update_switcher.py docs-repo/specsanalyzer/switcher.json $GITHUB_REF $VERSION | ||
- name: Copy documentation to the right version folder | ||
run: | | ||
mkdir -p docs-repo/${{ steps.version-folder.outputs.folder }} | ||
cp -r sphinx-docs/* docs-repo/${{ steps.version-folder.outputs.folder }} | ||
rm -rf docs-repo/${{ steps.version-folder.outputs.folder }}/.doctrees | ||
rm -rf docs-repo/${{ steps.version-folder.outputs.folder }}/tutorial/*.ipynb | ||
- name: Push changes | ||
run: | | ||
cd docs-repo | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
git add . | ||
git commit -m "Update documentation" | ||
git push |
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
Oops, something went wrong.