Skip to content

Commit

Permalink
CI (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
sosiristseng authored Jun 10, 2024
1 parent c4d92f1 commit 31ac031
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 56 deletions.
10 changes: 0 additions & 10 deletions .github/dependabot.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:best-practices"
],
"packageRules": [
{
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
}
],
"lockFileMaintenance": {
"enabled": true,
"automerge": true
},
"git-submodules": {
"enabled": true
},
"platformAutomerge": true,
"automergeStrategy": "squash"
}
53 changes: 29 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,54 +25,59 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Setup Python
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
id: setup-python
with:
python-version: '3.x'
- name: Cache python
uses: actions/cache@v4
- name: Cache python venv
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
if: ${{ contains(runner.name, 'GitHub Actions') }}
id: cache-py
id: cache-venv
with:
key: ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
path: |
${{ env.pythonLocation }}/lib
${{ env.pythonLocation }}/bin
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
path: .venv
- name: Install Python dependencies
if: ${{ !contains(runner.name, 'GitHub Actions') || steps.cache-py.outputs.cache-hit != 'true' }}
run: pip install -r requirements.txt
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
echo "${VIRTUAL_ENV}/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=${VIRTUAL_ENV}" >> $GITHUB_ENV
echo "PYTHON=${VIRTUAL_ENV}/bin/python" >> $GITHUB_ENV
echo "JULIA_PYTHONCALL_EXE=${VIRTUAL_ENV}/bin/python">> $GITHUB_ENV
- name: Cache executed notebooks
uses: actions/cache@v4
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
id: cache-nb
with:
path: ${{ env.NBCACHE }}
key: ${{ runner.os }}-nb-${{ env.CACHE_NUM }}-${{ hashFiles('src/**', 'Project.toml', 'Manifest.toml') }}-${{ hashFiles('docs/**/*.ipynb', 'docs/**/*.jl') }}
key: ${{ runner.os }}-nb-${{ env.CACHE_NUM }}-${{ hashFiles('src/**', 'Project.toml', 'Manifest.toml', 'requirements.txt') }}-${{ hashFiles('docs/**/*.ipynb', 'docs/**/*.jl') }}
restore-keys: |
${{ runner.os }}-nb-${{ env.CACHE_NUM }}-${{ hashFiles('src/**', 'Project.toml', 'Manifest.toml') }}-
${{ runner.os }}-nb-${{ env.CACHE_NUM }}-${{ hashFiles('src/**', 'Project.toml', 'Manifest.toml', 'requirements.txt') }}-
- name: Read Julia version
uses: SebRollen/toml-action@b1b3628f55fc3a28208d4203ada8b737e9687876 # v1.2.0
id: read_toml
run: echo "value=$(python -c 'import tomllib; from pathlib import Path; print(tomllib.loads(Path("Manifest.toml").read_text())["julia_version"])')" >> "$GITHUB_OUTPUT"
with:
file: 'Manifest.toml'
field: 'julia_version'
- name: Setup Julia
uses: julia-actions/setup-julia@v2
uses: julia-actions/setup-julia@f2258781c657ad9b4b88072c5eeaf9ec8c370874 # v2
with:
version: ${{ steps.read_toml.outputs.value }}
- name: Restore Julia packages
uses: actions/cache/restore@v4
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
if: ${{ contains(runner.name, 'GitHub Actions') }}
id: cache-julia
with:
path: |
~/.julia
!~/.julia/registries
key: ${{ runner.os }}-julia-${{ env.CACHE_NUM }}-${{ hashFiles('src/**', 'Project.toml', 'Manifest.toml') }}
key: ${{ runner.os }}-julia-${{ env.CACHE_NUM }}-${{ steps.read_toml.outputs.value }}-${{ hashFiles('src/**', 'Project.toml', 'Manifest.toml') }}
restore-keys: |
${{ runner.os }}-julia-${{ env.CACHE_NUM }}-
${{ runner.os }}-julia-${{ env.CACHE_NUM }}-${{ steps.read_toml.outputs.value }}-
- name: Install Julia packages
if: ${{ !contains(runner.name, 'GitHub Actions') || steps.cache-julia.outputs.cache-hit != 'true' }}
env:
PYTHON: ${{ steps.setup-python.outputs.python-path }}
shell: julia --color=yes {0}
run: |
using Pkg, Dates
Expand All @@ -82,7 +87,7 @@ jobs:
Pkg.precompile()
Pkg.gc(collect_delay=Day(0))
- name: Save Julia packages
uses: actions/cache/save@v4
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
if: ${{ contains(runner.name, 'GitHub Actions') && steps.cache-julia.outputs.cache-hit != 'true' }}
with:
path: |
Expand All @@ -97,7 +102,7 @@ jobs:
run: jupyter-book build docs/
- name: Upload pages artifact
if: ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-pages-artifact@v3
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
with:
path: docs/_build/html/

Expand All @@ -117,4 +122,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4
38 changes: 20 additions & 18 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *' # Every month
# push:
# branches:
# - main
# paths:
# - 'docs/**'
# - '.github/workflows/linkcheck.yml'
push:
branches:
- main
paths:
- 'docs/**'
- '.github/workflows/linkcheck.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -22,9 +22,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Setup Julia
uses: julia-actions/setup-julia@v2
uses: julia-actions/setup-julia@f2258781c657ad9b4b88072c5eeaf9ec8c370874 # v2
- name: Convert literate notebooks to ipynb files
shell: julia --color=yes {0}
working-directory: ${{ env.DIR }}
Expand All @@ -41,21 +41,23 @@ jobs:
end
end
- name: Setup Python
uses: actions/setup-python@v5
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5
id: setup-python
with:
python-version: '3.x'
- name: Cache python
uses: actions/cache@v4
- name: Cache python venv
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4
if: ${{ contains(runner.name, 'GitHub Actions') }}
id: cache-py
id: cache-venv
with:
key: ${{ runner.os }}-pip-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
path: |
${{ env.pythonLocation }}/lib
${{ env.pythonLocation }}/bin
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
path: .venv
- name: Install Python dependencies
if: ${{ !contains(runner.name, 'GitHub Actions') || steps.cache-py.outputs.cache-hit != 'true' }}
run: pip install -r requirements.txt
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install -r requirements.txt
echo "${VIRTUAL_ENV}/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=${VIRTUAL_ENV}" >> $GITHUB_ENV
- name: Build website
run: jupyter-book build ${DIR} --builder linkcheck
8 changes: 4 additions & 4 deletions .github/workflows/update-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Setup Julia
uses: julia-actions/setup-julia@v2
uses: julia-actions/setup-julia@f2258781c657ad9b4b88072c5eeaf9ec8c370874 # v2
with:
version: '1'
- name: Update Julia dependencies
Expand All @@ -37,14 +37,14 @@ jobs:
# Authenticate with a custom GitHub APP
# https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#authenticating-with-github-app-generated-tokens
- name: Generate token for PR
uses: tibdex/github-app-token@v2
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2
id: generate-token
with:
app_id: ${{ env.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6
with:
title: Julia Dependency Update
token: ${{ steps.generate-token.outputs.token }}
Expand Down

0 comments on commit 31ac031

Please sign in to comment.