Skip to content

Commit 4f66251

Browse files
committed
WIP
1 parent 1a25617 commit 4f66251

File tree

2 files changed

+63
-4
lines changed

2 files changed

+63
-4
lines changed

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

Lines changed: 61 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- master
7-
pull_request:
7+
pull_request: {}
88
env:
99
CARGO_TERM_COLOR: always
1010
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>
@@ -13,9 +13,10 @@ jobs:
1313
build:
1414
runs-on: self-hosted
1515
permissions:
16-
contents: read
16+
contents: write
1717
deployments: write
1818
pull-requests: write
19+
actions: write
1920
env:
2021
RUSTC_WRAPPER: /usr/bin/sccache
2122
CARGO_INCREMENTAL: 0
@@ -47,9 +48,11 @@ jobs:
4748
rustc --version
4849
4950
- name: ✂ Replace template in <head> of index.html
51+
if: github.ref != 'refs/heads/master'
52+
env:
53+
INDEX_HTML_HEAD_REPLACEMENT: ""
5054
run: |
5155
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
52-
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT=""
5356
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
5457
5558
- name: 🌐 Build Graphite web code
@@ -70,6 +73,18 @@ jobs:
7073
projectName: graphite-dev
7174
directory: frontend/dist
7275

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

.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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy