Skip to content

Commit

Permalink
GHA runner (#290)
Browse files Browse the repository at this point in the history
* GHA runner

* nowarning

* version cache key
  • Loading branch information
sosiristseng authored Dec 27, 2023
1 parent 2f855de commit 6d24d3e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ concurrency:
cancel-in-progress: true

env:
NPROC: '3' # Number of Julia processes to run the notebooks
NPROC: '2' # Number of Julia processes to run the notebooks
CACHE_NUM: '1'
PY_VER: '3.12'
JULIA_CONDAPKG_BACKEND: 'Null'
JULIA_CI: 'true'

jobs:
CI:
runs-on: self-hosted
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -29,7 +29,14 @@ jobs:
id: cp
with:
python-version: ${{ env.PY_VER }}
- name: Cache pip
uses: actions/cache@v3
id: cache-pip
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-pip-${{ steps.cp.outputs.python-version }}-${{ hashFiles('requirements.txt') }}
- name: Install python packages
if: ${{ steps.cache-pip.outputs.cache-hit != 'true' }}
run: pip install -r requirements.txt
- name: Read Julia version
uses: SebRollen/[email protected]
Expand All @@ -38,13 +45,33 @@ jobs:
file: 'Manifest.toml'
field: 'julia_version'
- name: Install Julia using jill.sh
uses: julia-actions/setup-julia@v1
run: |
wget -O /tmp/jill.sh https://raw.githubusercontent.com/abelsiqueira/jill/main/jill.sh
bash /tmp/jill.sh --version ${{ steps.read_toml.outputs.value }} -y
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Cache Julia packages
uses: actions/cache/restore@v3
id: cache-julia
with:
version: ${{ steps.read_toml.outputs.value }}
path: |
~/.julia
!~/.julia/registries
key: ${{ runner.os }}-julia-${{ steps.read_toml.outputs.value }}-${{ env.CACHE_NUM }}-${{ hashFiles('src/**','Project.toml', 'Manifest.toml')}}
restore-keys: |
${{ runner.os }}-julia-${{ steps.read_toml.outputs.value }}-${{ env.CACHE_NUM }}-
- name: Install Julia packages
if: ${{ steps.cache-julia.outputs.cache-hit != 'true' }}
run: |
julia --color=yes -e 'using Pkg; Pkg.add(["PrettyTables", "Literate"])'
julia --project=@. --color=yes -e 'using Pkg; Pkg.instantiate(); Pkg.resolve(); Pkg.precompile()'
julia --project=@. --color=yes -e 'using Pkg, Dates; Pkg.instantiate(); Pkg.resolve(); Pkg.precompile(); Pkg.gc(collect_delay=Day(0))'
- name: Save Julia packages
uses: actions/cache/save@v3
if: ${{ steps.cache-julia.outputs.cache-hit != 'true' }}
with:
path: |
~/.julia
!~/.julia/registries
key: ${{ steps.cache-julia.outputs.cache-primary-key }}
- name: Run program
run: julia --color=yes -p ${{ env.NPROC }} literate.jl
- name: Build website
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Julia
uses: julia-actions/setup-julia@v1
with:
version: '^1.10.0-rc1'
version: '1'
- name: Update Julia dependencies
env:
JULIA_PKG_PRECOMPILE_AUTO: '0'
Expand Down
4 changes: 2 additions & 2 deletions docs/intro-01-first-steps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,10 @@ https://en.wikipedia.org › wiki › Short-circuit_evaluation).
===#

# && evaluates and returns the second argument if the first is true
true && println("Hi")
(2 > 1) && println("Hi")

# && otherwise returns false
false && println("Hi")
(2 < 1) && println("Hi")

# `if` block has return value(s)
let score = 10
Expand Down

0 comments on commit 6d24d3e

Please sign in to comment.