From 2b57c87e5606bd3488cfaa1753d607ba743b8cea Mon Sep 17 00:00:00 2001 From: Wen Wei Tseng Date: Thu, 26 Oct 2023 20:52:27 +0800 Subject: [PATCH] CI --- .github/dependabot.yml | 23 --------- .github/workflows/ci.yml | 72 +++++++++++++++++---------- .github/workflows/update-manifest.yml | 17 ++----- renovate.json | 9 ++++ 4 files changed, 59 insertions(+), 62 deletions(-) delete mode 100644 .github/dependabot.yml create mode 100644 renovate.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index d88ba24..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,23 +0,0 @@ -version: 2 -updates: - - package-ecosystem: pip - directory: "/" - open-pull-requests-limit: 1 - schedule: - interval: daily - labels: - - automerge - - package-ecosystem: github-actions - directory: "/" - open-pull-requests-limit: 1 - schedule: - interval: daily - labels: - - automerge - - package-ecosystem: docker - directory: "/" - open-pull-requests-limit: 1 - schedule: - interval: daily - labels: - - automerge diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e69adb6..76e2763 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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: > diff --git a/.github/workflows/update-manifest.yml b/.github/workflows/update-manifest.yml index c1bcb30..d4d0102 100644 --- a/.github/workflows/update-manifest.yml +++ b/.github/workflows/update-manifest.yml @@ -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: @@ -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 diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..639b62b --- /dev/null +++ b/renovate.json @@ -0,0 +1,9 @@ +{ + "extends": [ + "config:recommended", + ":automergeMajor" + ], + "git-submodules": { + "enabled": true + } +}