Skip to content

Commit

Permalink
CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sosiristseng committed Oct 26, 2023
1 parent 4e78891 commit 2b57c87
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 62 deletions.
23 changes: 0 additions & 23 deletions .github/dependabot.yml

This file was deleted.

72 changes: 47 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,51 @@ concurrency:
env:
TIMEOUT: '-1' # nbconvert timeout
EXTRA_ARGS: '' # Extra arguments for nbconvert
PYTHON_VER: '3.11'

jobs:
setup:
permissions:
packages: write
runs-on: ubuntu-latest
container:
image: julia:1.9.3
env:
JULIA_CPU_TARGET: 'generic;haswell,clone_all'
JULIA_NUM_THREADS: auto
JULIA_CONDAPKG_BACKEND: 'Null'
JULIA_CI: 'true'
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
hash: ${{ steps.hash.outputs.id }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Get docker image hash
id: hash
run: echo "id=${{ hashFiles('requirements.txt', 'Project.toml', 'Manifest.toml', 'src/**', 'env.Dockerfile') }}" >> "$GITHUB_OUTPUT"
- name: Build and cache Docker container
uses: docker/build-push-action@v5
python-version: ${{ env.PYTHON_VER }}
- name: Cache Julia deps
uses: actions/cache@v3
with:
context: .
file: 'env.Dockerfile'
tags: ghcr.io/${{ github.repository }}:${{ steps.hash.outputs.id }}
push: true
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:${{ steps.hash.outputs.id }}
cache-to: type=inline
path: |
~/.julia/artifacts
~/.julia/compiled
~/.julia/packages
~/.julia/environments
key: ${{ runner.os }}-juliacontainer-${{ hashFiles('src/**','Project.toml', 'Manifest.toml')}}
restore-keys: |
${{ runner.os }}-juliacontainer-
- name: Install Julia deps
env:
PYTHON: ${{ env.pythonLocation }}/python
JULIA_PYTHONCALL_EXE: ${{ env.pythonLocation }}/python
shell: julia --color=yes {0}
run: |
using Pkg
Pkg.add(["IJulia"])
using IJulia
IJulia.installkernel("Julia", "--project=@.")
Pkg.activate(".")
Pkg.instantiate()
Pkg.gc()
- name: List notebooks as a JSON array
id: set-matrix
working-directory: docs
Expand All @@ -61,7 +74,7 @@ jobs:
notebook: ${{ fromJSON(needs.setup.outputs.matrix) }}
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository }}:${{ needs.setup.outputs.hash }}
image: julia:1.9.3
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -70,10 +83,19 @@ jobs:
id: cache
with:
path: docs/${{ matrix.notebook }}
key: ${{ runner.os }}-notebook-${{ hashFiles(format('docs/{0}', matrix.notebook)) }}-${{ needs.setup.outputs.hash }}
- name: Install Julia kernel
key: ${{ runner.os }}-notebook-${{ hashFiles(format('docs/{0}', matrix.notebook), 'src/**', 'Project.toml', 'Manifest.toml') }}
- name: Cache Julia deps
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: julia -e 'import IJulia; IJulia.installkernel("Julia", "--project=@.")'
uses: actions/cache@v3
with:
path: |
~/.julia/artifacts
~/.julia/compiled
~/.julia/packages
~/.julia/environments
key: ${{ runner.os }}-juliacontainer-${{ hashFiles('src/**','Project.toml', 'Manifest.toml')}}
restore-keys: |
${{ runner.os }}-juliacontainer-
- name: Execute Notebook
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: >
Expand Down
17 changes: 3 additions & 14 deletions .github/workflows/update-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ concurrency:

env:
APP_ID: '189113' # https://github.com/apps/wen-wei-s-pr-bot
IMG_NAME: 'app:test'

jobs:
update-manifest:
Expand All @@ -27,20 +26,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build and load docker image
uses: docker/build-push-action@v5
with:
context: .
file: 'env.Dockerfile'
tags: ${{ env.IMG_NAME }}
load: true
target: base
- name: Setup Julia
uses: julia-actions/setup-julia@v1
- name: Update Julia dependencies
run: >
docker run --rm -e JULIA_PKG_PRECOMPILE_AUTO=0
-w /tmp -v ${{ github.workspace }}:/tmp
${{ env.IMG_NAME }}
julia --color=yes --project=@. -e 'import Pkg; Pkg.update()'
run: julia --color=yes --project=@. -e 'import Pkg; Pkg.update()'
# 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
Expand Down
9 changes: 9 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": [
"config:recommended",
":automergeMajor"
],
"git-submodules": {
"enabled": true
}
}

0 comments on commit 2b57c87

Please sign in to comment.