Skip to content

Commit db333c2

Browse files
authored
Introduce Makefile to make development more convenient (#234)
* introduce `Makefile` * minor changes
1 parent 6d4bfec commit db333c2

File tree

4 files changed

+39
-9
lines changed

4 files changed

+39
-9
lines changed

.github/pull_request_template.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ Thank you for contributing to `QuantumToolbox.jl`! Please make sure you have fin
33

44
- [ ] Please read [Contributor Covenant Code of Conduct](https://github.com/qutip/QuantumToolbox.jl/blob/main/CODE_OF_CONDUCT.md)
55
- [ ] Any code changes were done in a way that does not break public API
6-
- [ ] Appropriate tests were added.
7-
- [ ] Any code changes should be formatted by running: `julia -e 'using JuliaFormatter; format(".")'`
8-
- [ ] All documentation (in `docs/` folder) related to code changes were updated.
6+
- [ ] Appropriate tests were added and tested locally by running: `make test`.
7+
- [ ] Any code changes should be `julia` formatted by running: `make format`.
8+
- [ ] All documents (in `docs/` folder) related to code changes were updated and able to build locally by running `make docs`.
99

1010
Request for a review after you have completed all the tasks. If you have not finished them all, you can also open a [Draft Pull Request](https://github.blog/2019-02-14-introducing-draft-pull-requests/) to let the others know this on-going work.
1111

1212
## Description
1313
Describe the proposed change here.
1414

1515
## Related issues or PRs
16-
Please mention the related issues or PRs here. If the PR fixes an issue, use the keyword close/closes/closed/fix/fixes/fixed/resolve/resolves/resolved followed by the issue id, e.g. fix #1234
16+
Please mention the related issues or PRs here. If the PR fixes an issue, use the keyword close/closes/closed/fix/fixes/fixed/resolve/resolves/resolved followed by the issue id, e.g. fix #[id]
1717

18-
## Additional context
18+
## Additional context

.github/workflows/FormatCheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,6 @@ jobs:
4545
write(stdout, output)
4646
write(stdout, "-----\n")
4747
write(stdout, "Please format them by running the following command:\n")
48-
write(stdout, "julia -e \"using JuliaFormatter; format(\\\".\\\")\"")
48+
write(stdout, "make format")
4949
exit(1)
5050
end'

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
JULIA:=julia
2+
3+
default: help
4+
5+
docs:
6+
${JULIA} --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
7+
${JULIA} --project=docs docs/make.jl
8+
9+
format:
10+
${JULIA} -e 'using JuliaFormatter; format(".")'
11+
12+
test:
13+
${JULIA} --project -e 'using Pkg; Pkg.resolve(); Pkg.test()'
14+
15+
help:
16+
@echo "The following make commands are available:"
17+
@echo " - make docs: instantiate and build the documentation"
18+
@echo " - make format: format codes with JuliaFormatter"
19+
@echo " - make test: run the tests"
20+
21+
.PHONY: default docs format test help

docs/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@
33
## Working Directory
44
All the commands should be run under the root folder of the package: `/path/to/QuantumToolbox.jl/`
55

6-
## Build Pkg
6+
The document pages will be generated in the directory: `/path/to/QuantumToolbox.jl/docs/build/` (which is ignored by git).
7+
8+
## Method 1: Run with `make` command
9+
Run the following command:
10+
```shell
11+
make docs
12+
```
13+
14+
## Method 2: Run `julia` command manually
15+
16+
### Build Pkg
717
Run the following command:
818
```shell
919
julia --project=docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
1020
```
1121
> **_NOTE:_** `Pkg.develop(PackageSpec(path=pwd()))` adds the local version of `QuantumToolbox` as dev-dependency instead of pulling from the registered version.
1222
13-
## Build Documentation
23+
### Build Documentation
1424
Run the following command:
1525
```shell
1626
julia --project=docs docs/make.jl
1727
```
18-
The document pages will be generated in the directory: `/path/to/QuantumToolbox.jl/docs/build/` (which is ignored by git).

0 commit comments

Comments
 (0)