Skip to content

Commit

Permalink
Merge pull request #105 from ytdHuang/makefile
Browse files Browse the repository at this point in the history
Add Makefile
  • Loading branch information
ytdHuang authored Sep 24, 2024
2 parents 0b7924d + 0e7bfea commit 4ac80ad
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ jobs:
write(stdout, output)
write(stdout, "-----\n")
write(stdout, "Please format them by running the following command:\n")
write(stdout, "julia -e \"using JuliaFormatter; format(\\\".\\\")\"")
write(stdout, "make format")
exit(1)
end'
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
JULIA:=julia

default: help

docs:
${JULIA} --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
${JULIA} --project=docs docs/make.jl

format:
${JULIA} -e 'using JuliaFormatter; format(".")'

test:
${JULIA} --project -e 'using Pkg; Pkg.resolve(); Pkg.test()'

help:
@echo "The following make commands are available:"
@echo " - make docs: instantiate and build the documentation"
@echo " - make format: format codes with JuliaFormatter"
@echo " - make test: run the tests"

.PHONY: default docs format test help
15 changes: 12 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,25 @@
## Working Directory
All the commands should be run under the root folder of the package: `/path/to/HierarchicalEOM.jl/`

## Build Pkg
The document pages will be generated in the directory: `/path/to/HierarchicalEOM.jl/docs/build/` (which is ignored by git).

## Method 1: Run with `make` command
Run the following command:
```shell
make docs
```

## Method 2: Run `julia` command manually

### Build Pkg
Run the following command:
```shell
julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
```
> **_NOTE:_** `Pkg.develop(PackageSpec(path=pwd()))` adds the local version of `HierarchicalEOM` as dev-dependency instead of pulling from the registered version.
## Build Documentation
### Build Documentation
Run the following command:
```shell
julia --project=docs docs/make.jl
```
The document pages will be generated in the directory: `/path/to/HierarchicalEOM.jl/docs/build/` (which is ignored by git).

0 comments on commit 4ac80ad

Please sign in to comment.