diff --git a/.github/workflows/all_components.yml b/.github/workflows/all_components.yml index 36ea7822..0dd9b69f 100644 --- a/.github/workflows/all_components.yml +++ b/.github/workflows/all_components.yml @@ -1,63 +1,112 @@ -# name: Add All Components +name: Add Components -# on: -# push: -# branches: -# - main -# paths: -# - /** -# - preview/**/*.rs -# - preview/**/Cargo.toml -# - primitives/**/*.rs -# - primitives/**/Cargo.toml -# - .github/** -# - Cargo.toml +on: + push: + branches: + - main + paths: + - /** + - preview/**/*.rs + - preview/**/Cargo.toml + - primitives/**/*.rs + - primitives/**/Cargo.toml + - .github/** + - Cargo.toml -# pull_request: -# types: [opened, synchronize, reopened, ready_for_review] -# branches: -# - main -# paths: -# - /** -# - preview/**/*.rs -# - preview/**/Cargo.toml -# - primitives/**/*.rs -# - primitives/**/Cargo.toml -# - .github/** -# - Cargo.toml + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + branches: + - main + paths: + - /** + - preview/**/*.rs + - preview/**/Cargo.toml + - primitives/**/*.rs + - primitives/**/Cargo.toml + - .github/** + - Cargo.toml -# concurrency: -# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} -# cancel-in-progress: true +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true -# jobs: -# deploy-preview: -# if: github.event.pull_request.draft == false -# name: Add All Components -# runs-on: ubuntu-latest -# env: -# CARGO_INCREMENTAL: 1 -# steps: -# - name: Checkout code -# uses: actions/checkout@v4 -# with: -# ref: "refs/pull/${{ github.event.pull_request.number }}/merge" -# fetch-depth: 0 -# - uses: awalsh128/cache-apt-pkgs-action@latest -# with: -# packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev -# version: 1.0 -# - name: Install Rust -# uses: dtolnay/rust-toolchain@master -# with: -# toolchain: stable -# targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown -# - uses: Swatinem/rust-cache@v2 -# with: -# cache-all-crates: "true" -# cache-on-failure: "false" -# - uses: cargo-bins/cargo-binstall@main -# - name: Install CLI -# run: cargo binstall dioxus-cli -y --force --version 0.7.0-rc.3 -# - name: Add components and check -# run: cd test-harness && dx components add --all --path .. --force && cargo check --all-features +jobs: + add-all-components: + if: github.event.pull_request.draft == false + name: Add All Components + runs-on: ubuntu-latest + env: + CARGO_INCREMENTAL: 1 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: "refs/pull/${{ github.event.pull_request.number }}/merge" + fetch-depth: 0 + - uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev + version: 1.0 + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown + - uses: Swatinem/rust-cache@v2 + with: + cache-all-crates: "true" + cache-on-failure: "false" + - name: Install CLI + run: cargo install dioxus-cli --git https://github.com/DioxusLabs/dioxus + - name: Add components and check + run: cd test-harness && dx components add --all --path .. --force && cargo check --all-features + add-each-component: + if: github.event.pull_request.draft == false + name: Add Each Components + runs-on: ubuntu-latest + env: + CARGO_INCREMENTAL: 1 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: "refs/pull/${{ github.event.pull_request.number }}/merge" + fetch-depth: 0 + - uses: awalsh128/cache-apt-pkgs-action@latest + with: + packages: libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev libxdo-dev + version: 1.0 + - name: Install Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown + - uses: Swatinem/rust-cache@v2 + with: + cache-all-crates: "true" + cache-on-failure: "false" + - name: Install CLI + run: cargo install dioxus-cli --git https://github.com/DioxusLabs/dioxus + - name: Add each component and check + run: | + cd preview/src/components/ + for file in *; do + if [ -d "$file" ]; then + echo "Testing component: $file" + else + continue + fi + # Go to test harness + cd ../../../test-harness + # Add dependencies manually; TODO: remove this once dx components supports local dependencies + if [ "$file" = "date_picker" ]; then + dx components add calendar,popover --path .. + fi + # Add the component + dx components add "$file" --path .. + # Make sure it still builds + cargo check --all-features + # Undo changes + dx components remove --all --path .. + cd ../preview/src/components/ + done diff --git a/preview/src/components/date_picker/component.json b/preview/src/components/date_picker/component.json index 583cd28f..7387945d 100644 --- a/preview/src/components/date_picker/component.json +++ b/preview/src/components/date_picker/component.json @@ -9,5 +9,6 @@ "git": "https://github.com/DioxusLabs/components" } ], + "componentDependencies": ["calendar", "popover"], "globalAssets": ["../../../assets/dx-components-theme.css"] }