CI #202
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: CI | |
on: | |
push: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
PYTHONUTF8: 1 | |
CACHEKEY: dist | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
tool-cache: false | |
- uses: mamba-org/setup-micromamba@v1 | |
with: | |
environment-file: env.yaml | |
post-cleanup: 'all' | |
- name: Prepare env | |
run: | | |
sed -i 's/\"package\"/\"image\"/' ./config.json | |
- name: Restore cache | |
uses: actions/cache/restore@v3 | |
id: cache-restore | |
with: | |
path: ./dist | |
key: ${{ env.CACHEKEY }} | |
- name: Force update | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, '[update]') }} | |
run: | | |
rm -f ./dist/indexer.json | |
- name: Force update std | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, '[std]') }} | |
shell: micromamba-shell {0} | |
run: | | |
python -m index clear-std | |
- name: Run processing | |
shell: micromamba-shell {0} | |
run: | | |
python -m index | |
# - name: Run indexing | |
# shell: micromamba-shell {0} | |
# run: | | |
# python -m index index | |
- name: Remove logs | |
continue-on-error: true | |
run: | | |
rm -f ./dist/data/*/*/*.log | |
- name: Delete previous cache | |
if: ${{ steps.cache-restore.outputs.cache-hit }} | |
continue-on-error: true | |
run: | | |
gh extension install actions/gh-actions-cache | |
gh actions-cache delete "${{ env.CACHEKEY }}" --confirm | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Save cache | |
uses: actions/cache/save@v3 | |
id: cache-save | |
with: | |
path: ./dist | |
key: ${{ env.CACHEKEY }} | |
- name: Show storage usage | |
run: | | |
sudo df -h | |
- name: Upload dist artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: ./dist | |
- name: Upload cache artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cache | |
path: | | |
./cache | |
!./cache/*/wheels | |
- name: Upload pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./dist | |
deploy: | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |