浏览代码

Update all uncommented commands to remove actions-rs (#1366)

* Update all uncommented commands to remove actions-rs (#1)

* install target in toolchain action

* add linux target explicitly

* try latest

* fix install
Evan Simkowitz 1 年之前
父节点
当前提交
de87ba6548
共有 3 个文件被更改,包括 65 次插入86 次删除
  1. 22 24
      .github/workflows/main.yml
  2. 34 37
      .github/workflows/playwright.yml
  3. 9 25
      packages/cli/.github/workflows/main.yml

+ 22 - 24
.github/workflows/main.yml

@@ -85,52 +85,56 @@ jobs:
 
   matrix_test:
     runs-on: ${{ matrix.platform.os }}
+    env:
+      RUST_CARGO_COMMAND: ${{ matrix.platform.cross == true && 'cross' || 'cargo' }}
     strategy:
       matrix:
         platform:
           - {
               target: x86_64-pc-windows-msvc,
               os: windows-latest,
-              toolchain: '1.70.0',
+              toolchain: "1.70.0",
               cross: false,
-              command: 'test',
-              args: '--all --tests'
+              command: "test",
+              args: "--all --tests",
             }
           - {
               target: x86_64-apple-darwin,
               os: macos-latest,
-              toolchain: '1.70.0',
+              toolchain: "1.70.0",
               cross: false,
-              command: 'test',
-              args: '--all --tests'
+              command: "test",
+              args: "--all --tests",
             }
           - {
               target: aarch64-apple-ios,
               os: macos-latest,
-              toolchain: '1.70.0',
+              toolchain: "1.70.0",
               cross: false,
-              command: 'build',
-              args: '--package dioxus-mobile'
+              command: "build",
+              args: "--package dioxus-mobile",
             }
           - {
               target: aarch64-linux-android,
               os: ubuntu-latest,
-              toolchain: '1.70.0',
+              toolchain: "1.70.0",
               cross: true,
-              command: 'build',
-              args: '--package dioxus-mobile'
+              command: "build",
+              args: "--package dioxus-mobile",
             }
 
     steps:
       - uses: actions/checkout@v3
 
       - name: install stable
-        uses: actions-rs/toolchain@v1
+        uses: dtolnay/rust-toolchain@master
         with:
           toolchain: ${{ matrix.platform.toolchain }}
-          target: ${{ matrix.platform.target }}
-          override: true
-          default: true
+          targets: ${{ matrix.platform.target }}
+
+      - name: Install cross
+        if: ${{ matrix.platform.cross == true }}
+        uses: taiki-e/install-action@cross
 
       - uses: Swatinem/rust-cache@v2
         with:
@@ -138,13 +142,8 @@ jobs:
           save-if: ${{ matrix.features.key == 'all' }}
 
       - name: test
-        uses: actions-rs/cargo@v1
-        with:
-          use-cross: ${{ matrix.platform.cross }}
-          command: ${{ matrix.platform.command }}
-          args: --target ${{ matrix.platform.target }} ${{ matrix.platform.args }}
-
-
+        run: |
+          ${{ env.RUST_CARGO_COMMAND }} ${{ matrix.platform.command }} ${{ matrix.platform.args }} --target ${{ matrix.platform.target }}
 
   # Coverage is disabled until we can fix it
   # coverage:
@@ -166,4 +165,3 @@ jobs:
   #       uses: codecov/codecov-action@v2
   #       with:
   #         fail_ci_if_error: false
-

+ 34 - 37
.github/workflows/playwright.yml

@@ -1,9 +1,9 @@
 name: Playwright Tests
 on:
   push:
-    branches: [ main, master ]
+    branches: [main, master]
   pull_request:
-    branches: [ main, master ]
+    branches: [main, master]
 defaults:
   run:
     working-directory: ./playwright-tests
@@ -16,39 +16,36 @@ jobs:
   test:
     if: github.event.pull_request.draft == false
     timeout-minutes: 60
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-latest
     steps:
-    # Do our best to cache the toolchain and node install steps
-    - uses: actions/checkout@v3
-    - uses: actions/setup-node@v3
-      with:
-        node-version: 16
-    - name: Install Rust
-      uses: actions-rs/toolchain@v1
-      with:
-        profile: minimal
-        toolchain: stable
-        override: true
-    - uses: Swatinem/rust-cache@v2
-    - name: Install WASM toolchain
-      run: rustup target add wasm32-unknown-unknown
-    - name: Install dependencies
-      run: npm ci
-    - name: Install Playwright
-      run: npm install -D @playwright/test
-    - name: Install Playwright Browsers
-      run: npx playwright install --with-deps
-    #  Cache the CLI by using cargo run internally
-    # - name: Install Dioxus CLI
-    #   uses: actions-rs/cargo@v1
-    #   with:
-    #     command: install
-    #     args: --path packages/cli
-    - name: Run Playwright tests
-      run: npx playwright test
-    - uses: actions/upload-artifact@v3
-      if: always()
-      with:
-        name: playwright-report
-        path: playwright-report/
-        retention-days: 30
+      # Do our best to cache the toolchain and node install steps
+      - uses: actions/checkout@v3
+      - uses: actions/setup-node@v3
+        with:
+          node-version: 16
+      - 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
+      - name: Install dependencies
+        run: npm ci
+      - name: Install Playwright
+        run: npm install -D @playwright/test
+      - name: Install Playwright Browsers
+        run: npx playwright install --with-deps
+      #  Cache the CLI by using cargo run internally
+      # - name: Install Dioxus CLI
+      #   uses: actions-rs/cargo@v1
+      #   with:
+      #     command: install
+      #     args: --path packages/cli
+      - name: Run Playwright tests
+        run: npx playwright test
+      - uses: actions/upload-artifact@v3
+        if: always()
+        with:
+          name: playwright-report
+          path: playwright-report/
+          retention-days: 30

+ 9 - 25
packages/cli/.github/workflows/main.yml

@@ -8,47 +8,31 @@ jobs:
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
-      - uses: actions-rs/toolchain@v1
-        with:
-          profile: minimal
-          toolchain: stable
-          override: true
+      - name: Install Rust
+        uses: dtolnay/rust-toolchain@stable
       - uses: Swatinem/rust-cache@v1
-      - uses: actions-rs/cargo@v1
-        with:
-          command: check
+      - run: cargo check
 
   test:
     name: Test Suite
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
-      - uses: actions-rs/toolchain@v1
-        with:
-          profile: minimal
-          toolchain: stable
-          override: true
+      - name: Install Rust
+        uses: dtolnay/rust-toolchain@stable
       - uses: Swatinem/rust-cache@v1
-      - uses: actions-rs/cargo@v1
-        with:
-          command: test
+      - run: cargo test
 
   fmt:
     name: Rustfmt
     runs-on: ubuntu-latest
     steps:
       - uses: actions/checkout@v2
-      - uses: actions-rs/toolchain@v1
-        with:
-          profile: minimal
-          toolchain: stable
-          override: true
+      - name: Install Rust
+        uses: dtolnay/rust-toolchain@stable
       - uses: Swatinem/rust-cache@v1
       - run: rustup component add rustfmt
-      - uses: actions-rs/cargo@v1
-        with:
-          command: fmt
-          args: --all -- --check
+      - run: cargo fmt --all -- --check
 
   # clippy:
   #  name: Clippy