44 push :
55 branches :
66 - master
7- pull_request :
8- branches :
9- - master
7+ pull_request : {}
108env :
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>
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
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
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
0 commit comments