Skip to content

Commit

Permalink
ci: speed up verification (#1347)
Browse files Browse the repository at this point in the history
* build: introduce ci task
* refactor(ci): rename cargo make task runner
* ci: add ci workflow
* ci: remove redundant workflows
  • Loading branch information
agilarity authored Jul 14, 2023
1 parent 4ad2232 commit 7902e7e
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 147 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
strategy:
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
fail-fast: false
uses: ./.github/workflows/run-example-task.yml
uses: ./.github/workflows/run-cargo-make-task.yml
with:
directory: ${{ matrix.directory }}
cargo_make_task: "check"
46 changes: 0 additions & 46 deletions .github/workflows/check.yml

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
matrix-job:
name: CI
strategy:
matrix:
directory:
[
integrations/actix,
integrations/axum,
integrations/viz,
integrations/utils,
leptos,
leptos_config,
leptos_dom,
leptos_hot_reload,
leptos_macro,
leptos_reactive,
leptos_server,
meta,
router,
server_fn,
server_fn/server_fn_macro_default,
server_fn_macro,
]
uses: ./.github/workflows/run-cargo-make-task.yml
with:
directory: ${{ matrix.directory }}
cargo_make_task: "ci"
34 changes: 0 additions & 34 deletions .github/workflows/fmt.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Example Task
name: Run Task

on:
workflow_call:
Expand Down Expand Up @@ -27,9 +27,9 @@ jobs:
steps:
# Setup environment
- name: Install playwright browser dependencies
run: |
run: |
sudo apt-get update
sudo apt-get install libegl1 libvpx7 libevent-2.1-7 libopus0 libopengl0 libwoff1 libharfbuzz-icu0 libgstreamer-plugins-base1.0-0 libgstreamer-gl1.0-0 libhyphen0 libmanette-0.2-0 libgles2 gstreamer1.0-libav
sudo apt-get install libegl1 libvpx7 libevent-2.1-7 libopus0 libopengl0 libwoff1 libharfbuzz-icu0 libgstreamer-plugins-base1.0-0 libgstreamer-gl1.0-0 libhyphen0 libmanette-0.2-0 libgles2 gstreamer1.0-libav
- uses: actions/checkout@v3

Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-store-
# Verify project
# Run Cargo Make Task
- name: ${{ inputs.cargo_make_task }}
run: |
if [ "${{ inputs.directory }}" = "INTERNAL" ]; then
Expand Down
46 changes: 0 additions & 46 deletions .github/workflows/test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/verify-all-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
strategy:
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
fail-fast: false
uses: ./.github/workflows/run-example-task.yml
uses: ./.github/workflows/run-cargo-make-task.yml
with:
directory: ${{ matrix.directory }}
cargo_make_task: "verify-flow"
2 changes: 1 addition & 1 deletion .github/workflows/verify-changed-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
strategy:
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
fail-fast: false
uses: ./.github/workflows/run-example-task.yml
uses: ./.github/workflows/run-cargo-make-task.yml
with:
directory: ${{ matrix.directory }}
cargo_make_task: "verify-flow"
7 changes: 7 additions & 0 deletions cargo-make/check.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[tasks.check]
alias = "check-all"

[tasks.check-all]
command = "cargo"
args = ["+nightly", "check-all-features"]
install_crate = "cargo-all-features"
9 changes: 9 additions & 0 deletions cargo-make/lint.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tasks.pre-clippy]
env = { CARGO_MAKE_CLIPPY_ARGS = "--all-targets --all-features -- -D warnings" }

[tasks.check-style]
dependencies = ["check-format-flow", "clippy-flow"]

[tasks.check-format]
env = { LEPTOS_PROJECT_DIRECTORY = "../" }
args = ["fmt", "--", "--check", "--config-path", "${LEPTOS_PROJECT_DIRECTORY}"]
24 changes: 10 additions & 14 deletions cargo-make/main.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
extend = [
{ path = "./check.toml" },
{ path = "./lint.toml" },
{ path = "./test.toml" },
]

[env]
RUSTFLAGS = ""
LEPTOS_OUTPUT_NAME = "ci" # allows examples to check/build without cargo-leptos

[env.github-actions]
RUSTFLAGS = "-D warnings"

[tasks.check]
alias = "check-all"

[tasks.check-all]
command = "cargo"
args = ["+nightly", "check-all-features"]
install_crate = "cargo-all-features"

[tasks.test]
alias = "test-all"
[tasks.ci]
dependencies = ["lint", "test"]

[tasks.test-all]
command = "cargo"
args = ["+nightly", "test-all-features"]
install_crate = "cargo-all-features"
[tasks.lint]
dependencies = ["check-format-flow"]
7 changes: 7 additions & 0 deletions cargo-make/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[tasks.test]
alias = "test-all"

[tasks.test-all]
command = "cargo"
args = ["+nightly", "test-all-features"]
install_crate = "cargo-all-features"
3 changes: 3 additions & 0 deletions integrations/actix/Makefile.toml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
extend = { path = "../../cargo-make/main.toml" }

[tasks.check-format]
env = { LEPTOS_PROJECT_DIRECTORY = "../../" }
3 changes: 3 additions & 0 deletions integrations/axum/Makefile.toml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
extend = { path = "../../cargo-make/main.toml" }

[tasks.check-format]
env = { LEPTOS_PROJECT_DIRECTORY = "../../" }
3 changes: 3 additions & 0 deletions integrations/utils/Makefile.toml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
extend = { path = "../../cargo-make/main.toml" }

[tasks.check-format]
env = { LEPTOS_PROJECT_DIRECTORY = "../../" }
3 changes: 3 additions & 0 deletions integrations/viz/Makefile.toml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
extend = { path = "../../cargo-make/main.toml" }

[tasks.check-format]
env = { LEPTOS_PROJECT_DIRECTORY = "../../" }
3 changes: 3 additions & 0 deletions server_fn/server_fn_macro_default/Makefile.toml
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
extend = { path = "../../cargo-make/main.toml" }

[tasks.check-format]
env = { LEPTOS_PROJECT_DIRECTORY = "../../" }

0 comments on commit 7902e7e

Please sign in to comment.