Skip to content

Commit efdecc5

Browse files
committed
Merge remote-tracking branch 'upstream/master' into Math
2 parents e056323 + 99966d8 commit efdecc5

328 files changed

Lines changed: 18261 additions & 22244 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-dev-and-ci.yml

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ on:
44
push:
55
branches:
66
- master
7-
pull_request:
8-
branches:
9-
- master
7+
pull_request: {}
108
env:
119
CARGO_TERM_COLOR: always
1210
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="dev.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.hash.js"></script>
@@ -15,9 +13,10 @@ jobs:
1513
build:
1614
runs-on: self-hosted
1715
permissions:
18-
contents: read
16+
contents: write
1917
deployments: write
2018
pull-requests: write
19+
actions: write
2120
env:
2221
RUSTC_WRAPPER: /usr/bin/sccache
2322
CARGO_INCREMENTAL: 0
@@ -49,9 +48,11 @@ jobs:
4948
rustc --version
5049
5150
- name: ✂ Replace template in <head> of index.html
51+
if: github.ref != 'refs/heads/master'
52+
env:
53+
INDEX_HTML_HEAD_REPLACEMENT: ""
5254
run: |
5355
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
54-
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT=""
5556
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
5657
5758
- name: 🌐 Build Graphite web code
@@ -72,6 +73,19 @@ jobs:
7273
projectName: graphite-dev
7374
directory: frontend/dist
7475

76+
- name: 💬 Comment build link URL to commit hash page on GitHub
77+
if: github.ref == 'refs/heads/master'
78+
env:
79+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
run: |
81+
gh api \
82+
-X POST \
83+
-H "Accept: application/vnd.github+json" \
84+
/repos/${{ github.repository }}/commits/$(git rev-parse HEAD)/comments \
85+
-f body="| 📦 **Build Complete for** $(git rev-parse HEAD) |
86+
|-|
87+
| ${{ steps.cloudflare.outputs.url }} |"
88+
7589
- name: 👕 Lint Graphite web formatting
7690
env:
7791
NODE_ENV: production
@@ -84,13 +98,60 @@ jobs:
8498
mold -run cargo fmt --all -- --check
8599
86100
- name: 🦀 Build Rust code
101+
env:
102+
RUSTFLAGS: -Dwarnings
87103
run: |
88104
mold -run cargo build --all-features
89105
90106
- name: 🧪 Run Rust tests
91107
run: |
92108
mold -run cargo test --all-features --workspace
93109
110+
- name: 📃 Generate code documentation info for website
111+
if: github.ref == 'refs/heads/master'
112+
run: |
113+
cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree
114+
mkdir -p artifacts-generated
115+
mv hierarchical_message_system_tree.txt artifacts-generated/hierarchical_message_system_tree.txt
116+
117+
- name: 💿 Obtain cache of auto-generated code docs artifacts, to check if they've changed
118+
if: github.ref == 'refs/heads/master'
119+
id: cache-website-code-docs
120+
uses: actions/cache/restore@v3
121+
with:
122+
path: artifacts
123+
key: website-code-docs
124+
125+
- name: 🔍 Check if auto-generated code docs artifacts changed
126+
if: github.ref == 'refs/heads/master'
127+
id: website-code-docs-changed
128+
run: |
129+
if ! diff --brief --recursive artifacts-generated artifacts; then
130+
echo "Auto-generated code docs artifacts have changed."
131+
rm -rf artifacts
132+
mv artifacts-generated artifacts
133+
echo "changed=true" >> $GITHUB_OUTPUT
134+
else
135+
echo "Auto-generated code docs artifacts have not changed."
136+
rm -rf artifacts
137+
rm -rf artifacts-generated
138+
fi
139+
140+
- name: 💾 Save cache of auto-generated code docs artifacts
141+
if: steps.website-code-docs-changed.outputs.changed == 'true'
142+
uses: actions/cache/save@v3
143+
with:
144+
path: artifacts
145+
key: ${{ steps.cache-website-code-docs.outputs.cache-primary-key }}
146+
147+
- name: ♻️ Trigger website rebuild if the auto-generated code docs artifacts have changed
148+
if: steps.website-code-docs-changed.outputs.changed == 'true'
149+
env:
150+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151+
run: |
152+
rm -rf artifacts
153+
gh workflow run website.yml --ref master
154+
94155
# miri:
95156
# runs-on: self-hosted
96157

.github/workflows/comment-!build-commands.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ jobs:
7373
rustc --version
7474
7575
- name: ✂ Replace template in <head> of index.html
76+
env:
77+
INDEX_HTML_HEAD_REPLACEMENT: ""
7678
run: |
7779
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
78-
export INDEX_HTML_HEAD_REPLACEMENT=""
7980
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
8081
8182
- name: ⌨ Set build command based on comment

.github/workflows/comment-clippy-warnings.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Clippy Check
22

33
on:
44
pull_request:
5-
branches: [master]
65
types: [opened, reopened, synchronize, ready_for_review]
76

87
jobs:

.github/workflows/comment-profiling-changes.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Profiling Changes
22

33
on:
44
pull_request:
5-
branches: [master]
65

76
env:
87
CARGO_TERM_COLOR: always

.github/workflows/library-rawkit.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ on:
77
paths:
88
- "libraries/rawkit/**"
99
pull_request:
10-
branches:
11-
- master
1210
paths:
1311
- "libraries/rawkit/**"
1412

.github/workflows/website.yml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ on:
77
paths:
88
- website/**
99
pull_request:
10-
branches:
11-
- master
1210
paths:
1311
- website/**
12+
workflow_dispatch: {}
1413
env:
1514
CARGO_TERM_COLOR: always
1615
INDEX_HTML_HEAD_INCLUSION: <script defer data-domain="graphite.rs" data-api="/visit/event" src="/visit/script.hash.js"></script>
@@ -32,11 +31,47 @@ jobs:
3231
with:
3332
tool: zola@0.20.0
3433

34+
- name: 🔍 Check if `website/other` directory changed
35+
uses: dorny/paths-filter@v3
36+
id: changes
37+
with:
38+
filters: |
39+
website-other:
40+
- "website/other/**"
41+
3542
- name: ✂ Replace template in <head> of index.html
3643
run: |
3744
# Remove the INDEX_HTML_HEAD_INCLUSION environment variable for build links (not master deploys)
3845
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_INCLUSION=""
3946
47+
- name: 💿 Obtain cache of auto-generated code docs artifacts
48+
id: cache-website-code-docs
49+
uses: actions/cache/restore@v3
50+
with:
51+
path: artifacts
52+
key: website-code-docs
53+
54+
- name: 📁 Fallback in case auto-generated code docs artifacts weren't cached
55+
if: steps.cache-website-code-docs.outputs.cache-hit != 'true'
56+
run: |
57+
echo "🦀 Initial system version of Rust:"
58+
rustc --version
59+
rustup update stable
60+
echo "🦀 Latest updated version of Rust:"
61+
rustc --version
62+
cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree
63+
mkdir artifacts
64+
mv hierarchical_message_system_tree.txt artifacts/hierarchical_message_system_tree.txt
65+
66+
- name: 🚚 Move `artifacts` contents to `website/other/editor-structure`
67+
run: |
68+
mv artifacts/* website/other/editor-structure
69+
70+
- name: 🔧 Build auto-generated code docs artifacts into HTML
71+
run: |
72+
cd website/other/editor-structure
73+
node generate.js hierarchical_message_system_tree.txt replacement.html
74+
4075
- name: 🌐 Build Graphite website with Zola
4176
env:
4277
MODE: prod
@@ -45,16 +80,8 @@ jobs:
4580
npm run install-fonts
4681
zola --config config.toml build --minify
4782
48-
- name: 🔍 Check if `website/other` directory changed
49-
uses: dorny/paths-filter@v3
50-
id: changes
51-
with:
52-
filters: |
53-
other:
54-
- "website/other/**"
55-
5683
- name: 💿 Restore cache of `website/other/dist` directory, if available and `website/other` didn't change
57-
if: steps.changes.outputs.other != 'true'
84+
if: steps.changes.outputs.website-other != 'true'
5885
id: cache-website-other-dist
5986
uses: actions/cache/restore@v3
6087
with:
@@ -82,6 +109,7 @@ jobs:
82109

83110
- name: 🚚 Move `website/other/dist` contents to `website/public`
84111
run: |
112+
mkdir -p website/public
85113
mv website/other/dist/* website/public
86114
87115
- name: 📤 Publish to Cloudflare Pages

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ perf.data*
55
profile.json
66
flamegraph.svg
77
.idea/
8+
.direnv
9+
hierarchical_message_system_tree.txt

.nix/flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
libraw
5252

5353

54-
# Tauri dependencies: keep in sync with https://v2.tauri.app/start/prerequisites/
54+
# Tauri dependencies: keep in sync with https://v2.tauri.app/start/prerequisites/#system-dependencies (under the NixOS tab)
5555
at-spi2-atk
5656
atkmm
5757
cairo

0 commit comments

Comments
 (0)