forked from ethereum/fe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
113 lines (86 loc) · 2.99 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
.PHONY: build-website
build-website:
echo -e "\033[0;32mBuilding website...\033[0m"
# Ensure we start from a clean state
rm -rf target/website
# Copy the entire website directory to target/website
cp -r website/ target/
# Fill version marker with current version
sed -i "s/{{FE_VERSION}}/$$(cargo pkgid fe | cut -d# -f2 | cut -d: -f2)/g" target/website/index.html
# Generate the compiler API docs
cargo doc --no-deps --workspace
# Move the API docs into the compiler-docs subdirectory within the website
mv target/doc target/website/compiler-docs
# Generate the Fe guide into the docs subdirectory within the website
cd docs; mdbook build -d ../target/website/docs
.PHONY: serve-website
serve-website: build-website
echo -e "\033[0;32mServing website locally...\033[0m"
cd target/website; python3 -m http.server 8000
.PHONY: deploy-website
deploy-website: build-website
echo -e "\033[0;32mDeploying website...\033[0m"
# delete old gh-pages-tmp + gh-pages-dist branch if they exists
-git branch -D gh-pages-tmp gh-pages-dist
# Recreate it
git checkout -b gh-pages-tmp
# Add changes to git.
git add -f target/website
# Commit changes.
git commit -m "Generated website"
# Only preserve target/website as the root of contents for this branch
git subtree split -P target/website -b gh-pages-dist
# Push to Github Pages
git push -f upstream gh-pages-dist:gh-pages
# Go where we came from
git checkout -
# Delete temporary branches
git branch -D gh-pages-tmp
git branch -D gh-pages-dist
.PHONY: docker-test
docker-test:
docker run \
--rm \
--volume "$(shell pwd):/mnt" \
--workdir '/mnt' \
rustlang/rust:nightly \
cargo test --workspace
.PHONY: docker-wasm-test
docker-wasm-test:
docker run \
--rm \
--volume "$(shell pwd):/mnt" \
--workdir '/mnt' \
davesque/rust-wasm \
wasm-pack test --node -- --workspace
.PHONY: coverage
coverage:
cargo tarpaulin --workspace --all-features --verbose --timeout 120 --exclude-files 'tests/*' --exclude-files 'main.rs' --out xml html
.PHONY: clippy
clippy:
cargo clippy --workspace --all-targets --all-features -- -D warnings -A clippy::upper-case-acronyms
.PHONY: rustfmt
rustfmt:
cargo fmt --all -- --check
.PHONY: lint
lint: rustfmt clippy
.PHONY: build-docs
build-docs:
cargo doc --no-deps --workspace
README.md: src/main.rs
cargo readme --no-title --no-indent-headings > README.md
notes:
towncrier --yes --version $(version)
git commit -m "Compile release notes"
release:
# Ensure release notes where generated before running the release command
./newsfragments/validate_files.py is-empty
cargo release $(version) --all --skip-tag --skip-push
# Run the tests again because we may have to adjust some based on the update version
cargo test --workspace --features solc-backend
push-tag:
# Run `make release <version>` first
./newsfragments/validate_files.py is-empty
# Tag the release with the current version number
git tag "v$$(cargo pkgid fe | cut -d# -f2 | cut -d: -f2)"
git push --tags upstream master