Skip to content

Commit c695f60

Browse files
committed
add ci
1 parent e461710 commit c695f60

20 files changed

Lines changed: 626 additions & 578 deletions

File tree

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
1-
name: Clean Up Preview
1+
name: PR Preview Cleanup
22

33
on:
44
pull_request_target:
5-
types:
6-
- closed
5+
types: [closed]
76

87
permissions:
98
contents: write
10-
pages: write
119

1210
jobs:
13-
cleanup-preview:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v4
17-
- name: Create empty directory
18-
run: echo "empty_dir=$(mktemp -d)" >> "$GITHUB_ENV"
19-
- name: Deploy empty preview
20-
uses: JamesIves/github-pages-deploy-action@v4.2.3
21-
with:
22-
branch: gh-pages
23-
folder: ${{ env.empty_dir }}
24-
target-folder: pr-preview/pr-${{ github.event.pull_request.number }}/
25-
clean: true
26-
single-commit: true
11+
cleanup:
12+
uses: ealmloff/dioxus-ci/.github/workflows/clean-up-pr-preview.yml@main

.github/workflows/gh-pages.yml

Lines changed: 11 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2,88 +2,24 @@ name: GitHub Pages
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [main]
76
schedule:
87
- cron: "42 8 * * *"
98
workflow_dispatch:
109

10+
permissions:
11+
contents: write
12+
1113
concurrency:
1214
group: ${{ github.workflow }}-${{ github.ref }}
1315
cancel-in-progress: true
1416

15-
permissions:
16-
contents: write
17-
pages: write
18-
1917
jobs:
2018
build-deploy:
21-
name: Build And Deploy Demo
22-
runs-on: ubuntu-latest
23-
env:
24-
CARGO_INCREMENTAL: 1
25-
steps:
26-
- uses: actions/checkout@v4
27-
- uses: awalsh128/cache-apt-pkgs-action@latest
28-
with:
29-
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
30-
version: 1.0
31-
- uses: dtolnay/rust-toolchain@stable
32-
with:
33-
targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
34-
- uses: Swatinem/rust-cache@v2
35-
with:
36-
cache-all-crates: "true"
37-
cache-on-failure: "false"
38-
cache-directories: "target/dx"
39-
- uses: cargo-bins/cargo-binstall@main
40-
- name: Install Dioxus CLI
41-
run: cargo binstall dioxus-cli -y --force --version 0.7.7
42-
- name: Build
43-
run: cd demo && dx build --web --release --no-default-features --features web --debug-symbols false --base-path "${{ github.event.repository.name }}"
44-
- name: Copy output
45-
run: cp -r target/dx/dioxus-code-demo/release/web/public docs
46-
- name: Add GitHub Pages 404
47-
run: |
48-
cat > docs/404.html <<'EOF'
49-
<!DOCTYPE html>
50-
<html lang="en">
51-
<head>
52-
<meta charset="UTF-8">
53-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
54-
<title>Redirecting</title>
55-
</head>
56-
<body>
57-
<script>
58-
const parts = window.location.pathname.split('/');
59-
let realUrl;
60-
if (parts[2] === 'pr-preview') {
61-
realUrl = '/' + parts.slice(1, 4).join('/') + '/';
62-
} else {
63-
realUrl = '/' + parts.slice(1, 2).join('/') + '/';
64-
}
65-
fetch(realUrl)
66-
.then(response => response.text())
67-
.then(html => {
68-
document.documentElement.innerHTML = html;
69-
document.documentElement.querySelectorAll('script').forEach(oldScript => {
70-
const newScript = document.createElement('script');
71-
for (const { name, value } of oldScript.attributes) {
72-
newScript.setAttribute(name, value);
73-
}
74-
newScript.textContent = oldScript.textContent;
75-
oldScript.replaceWith(newScript);
76-
});
77-
});
78-
</script>
79-
</body>
80-
</html>
81-
EOF
82-
- name: Deploy
83-
uses: JamesIves/github-pages-deploy-action@v4.2.3
84-
with:
85-
branch: gh-pages
86-
folder: docs
87-
target-folder: .
88-
clean: true
89-
clean-exclude: pr-preview/**
19+
uses: ealmloff/dioxus-ci/.github/workflows/deploy-gh-pages.yml@main
20+
with:
21+
working-directory: demo
22+
no-default-features: true
23+
features: web
24+
debug-symbols: false
25+
dx-cli-version: 0.7.7

.github/workflows/main.yml

Lines changed: 34 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,138 +1,56 @@
1-
name: Rust CI
1+
name: CI
22

33
on:
44
push:
5-
branches:
6-
- main
7-
paths:
8-
- "**"
5+
branches: [main]
96
pull_request:
107
types: [opened, synchronize, reopened, ready_for_review]
11-
branches:
12-
- main
13-
paths:
14-
- "**"
8+
branches: [main]
9+
10+
permissions:
11+
contents: read
1512

1613
concurrency:
1714
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1815
cancel-in-progress: true
1916

2017
jobs:
2118
check:
22-
if: github.event.pull_request.draft == false
23-
name: Check
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v4
27-
- uses: awalsh128/cache-apt-pkgs-action@latest
28-
with:
29-
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
30-
version: 1.0
31-
- uses: dtolnay/rust-toolchain@stable
32-
- uses: Swatinem/rust-cache@v2
33-
with:
34-
cache-all-crates: "true"
35-
cache-on-failure: "false"
36-
- name: Check
37-
run: cargo check --workspace --all-features
19+
uses: ealmloff/dioxus-ci/.github/workflows/check.yml@main
20+
with:
21+
all-features: false
22+
no-default-features: true
23+
features: dioxus-code/all-languages dioxus-code-editor/web dioxus-code-demo/web dioxus-code-live-input/web
3824

3925
test:
40-
if: github.event.pull_request.draft == false
41-
name: Test Suite
42-
runs-on: ubuntu-24.04
43-
steps:
44-
- uses: actions/checkout@v4
45-
- name: Free Disk Space
46-
uses: ./.github/actions/free-disk-space
47-
- uses: awalsh128/cache-apt-pkgs-action@latest
48-
with:
49-
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
50-
version: 1.0
51-
- uses: dtolnay/rust-toolchain@stable
52-
with:
53-
components: rustfmt, clippy
54-
- uses: Swatinem/rust-cache@v2
55-
with:
56-
cache-all-crates: "true"
57-
- uses: browser-actions/setup-firefox@latest
58-
- name: Test
59-
run: cargo test --workspace
26+
uses: ealmloff/dioxus-ci/.github/workflows/test.yml@main
27+
with:
28+
no-default-features: true
29+
features: dioxus-code/all-languages dioxus-code-editor/web dioxus-code-demo/web dioxus-code-live-input/web
6030

6131
fmt:
62-
if: github.event.pull_request.draft == false
63-
name: Rustfmt
64-
runs-on: ubuntu-24.04
65-
steps:
66-
- uses: actions/checkout@v4
67-
- uses: dtolnay/rust-toolchain@stable
68-
with:
69-
components: rustfmt
70-
- uses: Swatinem/rust-cache@v2
71-
with:
72-
cache-all-crates: "true"
73-
- name: Format
74-
run: cargo fmt --all -- --check
32+
uses: ealmloff/dioxus-ci/.github/workflows/fmt.yml@main
7533

7634
docs:
77-
if: github.event.pull_request.draft == false
78-
name: Docs
79-
runs-on: ubuntu-24.04
80-
steps:
81-
- uses: actions/checkout@v4
82-
- uses: awalsh128/cache-apt-pkgs-action@latest
83-
with:
84-
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
85-
version: 1.0
86-
- uses: dtolnay/rust-toolchain@nightly
87-
- uses: Swatinem/rust-cache@v2
88-
with:
89-
cache-all-crates: "true"
90-
- name: Docs
91-
run: cargo doc --workspace --no-deps --all-features --document-private-items
92-
env:
93-
RUSTDOCFLAGS: -Dwarnings --document-private-items
35+
uses: ealmloff/dioxus-ci/.github/workflows/docs.yml@main
36+
with:
37+
all-features: false
38+
no-default-features: true
39+
features: dioxus-code/all-languages dioxus-code-editor/web dioxus-code-demo/web dioxus-code-live-input/web
9440

9541
clippy:
96-
if: github.event.pull_request.draft == false
97-
name: Clippy
98-
runs-on: ubuntu-24.04
99-
steps:
100-
- uses: actions/checkout@v4
101-
- uses: awalsh128/cache-apt-pkgs-action@latest
102-
with:
103-
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
104-
version: 1.0
105-
- uses: dtolnay/rust-toolchain@stable
106-
with:
107-
components: rustfmt, clippy
108-
- uses: Swatinem/rust-cache@v2
109-
with:
110-
cache-all-crates: "true"
111-
- name: Clippy
112-
run: cargo clippy --workspace --examples --tests --all-features --all-targets -- -D warnings
42+
uses: ealmloff/dioxus-ci/.github/workflows/clippy.yml@main
43+
with:
44+
all-features: false
45+
no-default-features: true
46+
features: dioxus-code/all-languages dioxus-code-editor/web dioxus-code-demo/web dioxus-code-live-input/web
11347

11448
web-demo:
115-
if: github.event.pull_request.draft == false
116-
name: Web Demo
117-
runs-on: ubuntu-latest
118-
env:
119-
CARGO_INCREMENTAL: 1
120-
steps:
121-
- uses: actions/checkout@v4
122-
- uses: awalsh128/cache-apt-pkgs-action@latest
123-
with:
124-
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
125-
version: 1.0
126-
- uses: dtolnay/rust-toolchain@stable
127-
with:
128-
targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
129-
- uses: Swatinem/rust-cache@v2
130-
with:
131-
cache-all-crates: "true"
132-
cache-on-failure: "false"
133-
cache-directories: "target/dx"
134-
- uses: cargo-bins/cargo-binstall@main
135-
- name: Install Dioxus CLI
136-
run: cargo binstall dioxus-cli -y --force --version 0.7.7
137-
- name: Build web demo
138-
run: cd demo && dx build --web --release --no-default-features --features web --debug-symbols false --base-path "${{ github.event.repository.name }}"
49+
uses: ealmloff/dioxus-ci/.github/workflows/web-build.yml@main
50+
with:
51+
working-directory: demo
52+
no-default-features: true
53+
features: web
54+
debug-symbols: false
55+
base-path: ${{ github.event.repository.name }}
56+
dx-cli-version: 0.7.7

.github/workflows/nightly.yml

Lines changed: 34 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,44 @@ on:
55
- cron: "21 8 * * *"
66
workflow_dispatch:
77

8+
permissions:
9+
contents: read
10+
811
concurrency:
912
group: ${{ github.workflow }}-${{ github.ref }}
1013
cancel-in-progress: true
1114

1215
jobs:
13-
nightly:
14-
name: Nightly Toolchain
15-
runs-on: ubuntu-24.04
16-
steps:
17-
- uses: actions/checkout@v4
18-
- uses: awalsh128/cache-apt-pkgs-action@latest
19-
with:
20-
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
21-
version: 1.0
22-
- uses: dtolnay/rust-toolchain@nightly
23-
with:
24-
components: rustfmt, clippy
25-
targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
26-
- uses: Swatinem/rust-cache@v2
27-
with:
28-
cache-all-crates: "true"
29-
cache-on-failure: "true"
30-
- name: Check
31-
run: cargo check --workspace --all-features
32-
- name: Test
33-
run: cargo test --workspace
34-
- name: Clippy
35-
run: cargo clippy --workspace --examples --tests --all-features --all-targets -- -D warnings
16+
check:
17+
uses: ealmloff/dioxus-ci/.github/workflows/check.yml@main
18+
with:
19+
toolchain: nightly
20+
all-features: false
21+
no-default-features: true
22+
features: dioxus-code/all-languages dioxus-code-editor/web dioxus-code-demo/web dioxus-code-live-input/web
23+
24+
test:
25+
uses: ealmloff/dioxus-ci/.github/workflows/test.yml@main
26+
with:
27+
toolchain: nightly
28+
no-default-features: true
29+
features: dioxus-code/all-languages dioxus-code-editor/web dioxus-code-demo/web dioxus-code-live-input/web
30+
31+
clippy:
32+
uses: ealmloff/dioxus-ci/.github/workflows/clippy.yml@main
33+
with:
34+
toolchain: nightly
35+
all-features: false
36+
no-default-features: true
37+
features: dioxus-code/all-languages dioxus-code-editor/web dioxus-code-demo/web dioxus-code-live-input/web
3638

3739
web-demo:
38-
name: Nightly Web Demo Build
39-
runs-on: ubuntu-latest
40-
env:
41-
CARGO_INCREMENTAL: 1
42-
steps:
43-
- uses: actions/checkout@v4
44-
- uses: awalsh128/cache-apt-pkgs-action@latest
45-
with:
46-
packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev
47-
version: 1.0
48-
- uses: dtolnay/rust-toolchain@nightly
49-
with:
50-
targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
51-
- uses: Swatinem/rust-cache@v2
52-
with:
53-
cache-all-crates: "true"
54-
cache-on-failure: "true"
55-
cache-directories: "target/dx"
56-
- uses: cargo-bins/cargo-binstall@main
57-
- name: Install Dioxus CLI
58-
run: cargo binstall dioxus-cli -y --force --version 0.7.7
59-
- name: Build web demo
60-
run: cd demo && dx build --web --release --no-default-features --features web --debug-symbols false --base-path "${{ github.event.repository.name }}"
40+
uses: ealmloff/dioxus-ci/.github/workflows/web-build.yml@main
41+
with:
42+
working-directory: demo
43+
no-default-features: true
44+
features: web
45+
debug-symbols: false
46+
base-path: ${{ github.event.repository.name }}
47+
dx-cli-version: 0.7.7
48+
toolchain: nightly

0 commit comments

Comments
 (0)