diff --git a/.github/workflows/julia-docs.yml b/.github/workflows/julia-docs.yml new file mode 100644 index 00000000..cd190512 --- /dev/null +++ b/.github/workflows/julia-docs.yml @@ -0,0 +1,46 @@ +name: Julia Documentation + +on: + pull_request: + push: + branches: + - main + tags: '*' + +permissions: + contents: write + pull-requests: read + statuses: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + docbuild: + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v7 + + - uses: julia-actions/setup-julia@v3 + with: + version: '1.10' + + - uses: julia-actions/cache@v3 + + - name: Install dependencies + run: > + cd julia/MOLE.jl && + julia --project=docs -e 'using Pkg; + Pkg.develop(path="."); + Pkg.instantiate(; verbose=true); + Pkg.build()' + + - name: Build and deploy + env: + GKSwstype: "100" # headless GR: https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988/2 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token + run: > + cd julia/MOLE.jl && + julia --project=docs docs/make.jl \ No newline at end of file diff --git a/.github/workflows/julia-formatter.yml b/.github/workflows/julia-formatter.yml new file mode 100644 index 00000000..b78263b0 --- /dev/null +++ b/.github/workflows/julia-formatter.yml @@ -0,0 +1,45 @@ +name: Julia Formatter + +on: + pull_request: + branches: + - main + push: + branches: + - main + tags: '*' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + format: + name: Check Julia formatting + runs-on: ubuntu-latest + + defaults: + run: + working-directory: julia/MOLE.jl + + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Set up Julia + uses: julia-actions/setup-julia@v3 + with: + version: '1.10' + + - name: Cache Julia artifacts + uses: julia-actions/cache@v3 + + - name: Install JuliaFormatter + run: julia -e 'using Pkg; Pkg.add("JuliaFormatter")' + + - name: Check formatting + run: | + julia -e ' + using JuliaFormatter + format(".", overwrite=false, verbose=true) || error("Formatting issues detected") + ' \ No newline at end of file diff --git a/.github/workflows/julia-tests.yml b/.github/workflows/julia-tests.yml new file mode 100644 index 00000000..0799607f --- /dev/null +++ b/.github/workflows/julia-tests.yml @@ -0,0 +1,83 @@ +name: Julia Unit Tests + +on: + pull_request: + branches: + - main + push: + branches: + - main + tags: '*' + +# Needed to allow julia-actions/cache to delete old caches that it has created +permissions: + actions: write + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} + runs-on: ${{ matrix.os }} + timeout-minutes: ${{ matrix.os == 'macos-latest' && 120 || 80 }} + + strategy: + fail-fast: false + matrix: + version: + - '1.10' + - '1.11' + os: + - ubuntu-latest + - windows-latest + # There is a concurrency limit for MacOS runners across the + # entire organization. + # (see https://docs.github.com/en/actions/reference/limits#job-concurrency-limits-for-github-hosted-runners) + # To help with this, MacOS runners are only run when PRs are merged + # into the main branch. + - ${{ github.event_name == 'push' && 'macos-latest' || '' }} + exclude: + - os: '' + + defaults: + run: + working-directory: julia/MOLE.jl + + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Set up Julia + uses: julia-actions/setup-julia@v3 + with: + version: ${{ matrix.version }} + + - name: Cache Julia artifacts + uses: julia-actions/cache@v3 + + - name: Build package + uses: julia-actions/julia-buildpkg@latest + with: + project: julia/MOLE.jl + + - name: Run tests + uses: julia-actions/julia-runtest@latest + with: + project: julia/MOLE.jl + + - name: Process coverage + uses: julia-actions/julia-processcoverage@v1 + if: ${{ matrix.version == '1.10' && matrix.os == 'ubuntu-latest' }} + with: + directories: julia/MOLE.jl/src + + - name: Code Coverage + uses: codecov/codecov-action@v7 + if: ${{ matrix.version == '1.10' && matrix.os == 'ubuntu-latest' }} + with: + files: lcov.info + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.readthedocs-julia.yaml b/.readthedocs-julia.yaml new file mode 100644 index 00000000..ef7b7926 --- /dev/null +++ b/.readthedocs-julia.yaml @@ -0,0 +1,12 @@ +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.11" + julia: "1.10" + commands: + - cd julia/MOLE.jl && julia --project=docs -e 'using Pkg; Pkg.develop(path="."); Pkg.instantiate()' + - cd julia/MOLE.jl && julia --project=docs docs/make.jl + - mkdir -p _readthedocs/html + - cp -r julia/MOLE.jl/docs/build/* _readthedocs/html/ \ No newline at end of file diff --git a/julia/MOLE.jl/.JuliaFormatter.toml b/julia/MOLE.jl/.JuliaFormatter.toml new file mode 100644 index 00000000..e16d1f05 --- /dev/null +++ b/julia/MOLE.jl/.JuliaFormatter.toml @@ -0,0 +1,7 @@ +indent = 4 +margin = 92 +always_for_in = true +whitespace_typedefs = true +whitespace_ops_in_indices = true +remove_extra_newlines = false +join_lines_based_on_source = true \ No newline at end of file