-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add frontend build #24
Merged
RaulTrombin
merged 6 commits into
bluerobotics:master
from
RaulTrombin:add_frontend_build
Oct 7, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f8a46e9
Cargo: Add frontend building feature
RaulTrombin 3b1e315
Cargo: build: Add build_web method
RaulTrombin c10d881
src: server: Add built ping-viewer-next-frontend
RaulTrombin 8378f55
github: action: Add built frontend
RaulTrombin 9f0dff6
Clippy suggested fixes
RaulTrombin 497756b
ping-viewer-next-frontend: Add frontend project
RaulTrombin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,11 @@ jobs: | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
|
||
- name: Install build dependencies - Bun | ||
uses: oven-sh/setup-bun@v2 | ||
with: | ||
bun-version: 1.1.22 | ||
|
||
- name: Check style | ||
run: cargo fmt --check | ||
|
||
|
@@ -42,8 +47,31 @@ jobs: | |
- name: Build | ||
run: cargo build --verbose | ||
|
||
build-frontend: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v2 | ||
with: | ||
bun-version: 1.1.22 | ||
|
||
- name: Install dependencies and build Bun project | ||
run: | | ||
cd ping-viewer-next-frontend | ||
bun install --frozen-lockfile | ||
bun run build | ||
|
||
- name: Upload dist folder | ||
uses: actions/[email protected] | ||
with: | ||
name: dist | ||
path: ./ping-viewer-next-frontend/dist | ||
|
||
build: | ||
needs: quick-tests | ||
needs: [quick-tests, build-frontend] | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
|
@@ -73,11 +101,18 @@ jobs: | |
run: echo "${{ matrix.TARGET }}" | ||
|
||
- uses: actions/checkout@master | ||
|
||
- name: Download frontend build | ||
uses: actions/[email protected] | ||
with: | ||
name: dist | ||
path: ./ping-viewer-next-frontend/dist | ||
|
||
- name: Build | ||
uses: houseabsolute/[email protected] | ||
with: | ||
target: ${{ matrix.TARGET }} | ||
args: "--release" | ||
args: "--release --features embed-frontend" | ||
|
||
- name: Rename | ||
run: cp target/${{ matrix.TARGET }}/release/${{ github.event.repository.name }}${{ matrix.EXTENSION }} ${{ github.event.repository.name }}-${{ matrix.TARGET }}${{ matrix.EXTENSION }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
> 1% | ||
last 2 versions | ||
not dead | ||
not ie 11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{ | ||
"globals": { | ||
"Component": true, | ||
"ComponentPublicInstance": true, | ||
"ComputedRef": true, | ||
"EffectScope": true, | ||
"ExtractDefaultPropTypes": true, | ||
"ExtractPropTypes": true, | ||
"ExtractPublicPropTypes": true, | ||
"InjectionKey": true, | ||
"PropType": true, | ||
"Ref": true, | ||
"VNode": true, | ||
"WritableComputedRef": true, | ||
"computed": true, | ||
"createApp": true, | ||
"customRef": true, | ||
"defineAsyncComponent": true, | ||
"defineComponent": true, | ||
"effectScope": true, | ||
"getCurrentInstance": true, | ||
"getCurrentScope": true, | ||
"h": true, | ||
"inject": true, | ||
"isProxy": true, | ||
"isReactive": true, | ||
"isReadonly": true, | ||
"isRef": true, | ||
"markRaw": true, | ||
"nextTick": true, | ||
"onActivated": true, | ||
"onBeforeMount": true, | ||
"onBeforeRouteLeave": true, | ||
"onBeforeRouteUpdate": true, | ||
"onBeforeUnmount": true, | ||
"onBeforeUpdate": true, | ||
"onDeactivated": true, | ||
"onErrorCaptured": true, | ||
"onMounted": true, | ||
"onRenderTracked": true, | ||
"onRenderTriggered": true, | ||
"onScopeDispose": true, | ||
"onServerPrefetch": true, | ||
"onUnmounted": true, | ||
"onUpdated": true, | ||
"onWatcherCleanup": true, | ||
"provide": true, | ||
"reactive": true, | ||
"readonly": true, | ||
"ref": true, | ||
"resolveComponent": true, | ||
"shallowReactive": true, | ||
"shallowReadonly": true, | ||
"shallowRef": true, | ||
"toRaw": true, | ||
"toRef": true, | ||
"toRefs": true, | ||
"toValue": true, | ||
"triggerRef": true, | ||
"unref": true, | ||
"useAttrs": true, | ||
"useCssModule": true, | ||
"useCssVars": true, | ||
"useId": true, | ||
"useLink": true, | ||
"useModel": true, | ||
"useRoute": true, | ||
"useRouter": true, | ||
"useSlots": true, | ||
"useTemplateRef": true, | ||
"watch": true, | ||
"watchEffect": true, | ||
"watchPostEffect": true, | ||
"watchSyncEffect": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* .eslint.js | ||
* | ||
* ESLint configuration file. | ||
*/ | ||
|
||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true, | ||
}, | ||
extends: ["vuetify", "./.eslintrc-auto-import.json"], | ||
rules: { | ||
"vue/multi-word-component-names": "off", | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
/dist | ||
|
||
# Editor directories and files | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"hash": "f30e6af8", | ||
"configHash": "616d5c86", | ||
"lockfileHash": "e3b0c442", | ||
"browserHash": "b5f1b234", | ||
"optimized": {}, | ||
"chunks": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"$schema": "https://biomejs.dev/schemas/1.9.2/schema.json", | ||
"vcs": { | ||
"enabled": false, | ||
"clientKind": "git", | ||
"useIgnoreFile": false | ||
}, | ||
"files": { | ||
"ignoreUnknown": false, | ||
"ignore": [] | ||
}, | ||
"formatter": { | ||
"enabled": true, | ||
"indentStyle": "tab" | ||
}, | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true | ||
} | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "double" | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Ping Viewer Next</title> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="/src/main.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"target": "es5", | ||
"module": "esnext", | ||
"baseUrl": "./", | ||
"moduleResolution": "bundler", | ||
"paths": { | ||
"@/*": ["src/*"], | ||
"@components/*": ["src/components/*"] | ||
}, | ||
"lib": ["esnext", "dom", "dom.iterable", "scripthost"] | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I follow, we are already building it with build.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently we don't, only if the feature flag is enabled, so users only need to set npm/bun/front-end stuff if they want it.
The frontend is built only a single time and shared to the next actions to embeed it.
We have the flags:
build-frontend [embed-frontend]
and
embed-frontend itself
if this features isn't requested, it will only embed the simple .html on src/server/rest/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not following. Why are we building this in a different step ?
And why are we not building it with build.rs on the step that we are downloading it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To users choose if they want to setup the frontend related features on computer or not.
Also had issues to build the frontend on specific targets such armv7/aarch64 using Vue/Bun , and even we'll need to set an special container to cross compiling it inside.
So the built frontend is just embeded on the build steps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested here, and a simple
curl -fsSL https://bun.sh/install | bash
should work.Btw, we use bun in cockpit.