Преглед на файлове

enable new examples in smoke tests (#194)

* rename smoke tests

* split into prod and source runs

* rename test job names for clarity

* snake case gatsby site

* remove airtable api key

* add new examples

* add new examples to renovate

* add scripts to package.json

* finish off vanillajs example
Jacob Bolda преди 5 години
родител
ревизия
4f9d2e2ba7

+ 76 - 0
.github/workflows/smoke-test-prod.yml

@@ -0,0 +1,76 @@
+name: build smoke tests with prod
+
+on:
+  release:
+    types: [published]
+
+jobs:
+  via-prod:
+    runs-on: ${{ matrix.platform }}
+    timeout-minutes: 40
+
+    strategy:
+      fail-fast: false
+      matrix:
+        platform: [ubuntu-latest, macos-latest, windows-latest]
+        example: [react/gatsby-themed-site, react/create-react-app, react/next.js, vanilla/monolith, vue/quasar-app]
+        include:
+          - platform: ubuntu-latest
+            CARGO_HOME: ~/.cargo
+          - platform: macos-latest
+            CARGO_HOME: ~/.cargo
+          - platform: windows-latest
+            CARGO_HOME: ~/.cargo
+
+    steps:
+    - uses: actions/checkout@v1
+      with:
+        fetch-depth: 3
+    - name: install rust stable
+      uses: actions-rs/toolchain@v1
+      with:
+          toolchain: stable
+    - name: install webkit2gtk (ubuntu only)
+      if: matrix.platform == 'ubuntu-latest'
+      run: |
+           sudo apt-get update
+           sudo apt-get install -y webkit2gtk-4.0
+    - name: cache rust bin
+      id: cache_rust_bin
+      uses: actions/cache@v1
+      with:
+        path: ${{ format('{0}/bin/', matrix.CARGO_HOME) }}
+        key: ${{ runner.OS }}-build-bin-${{ hashFiles('**/Cargo.lock') }}-
+    - name: cache rust registry/index
+      id: cache_rust_reg_index
+      uses: actions/cache@v1
+      with:
+        path: ${{ format('{0}/registry/index/', matrix.CARGO_HOME) }}
+        key: ${{ runner.OS }}-build-reg-index-${{ hashFiles('**/Cargo.lock') }}-
+    - name: cache rust registry/cache
+      id: cache_rust_reg_cache
+      uses: actions/cache@v1
+      with:
+        path: ${{ format('{0}/registry/cache/', matrix.CARGO_HOME) }}
+        key: ${{ runner.OS }}-build-reg-cache-${{ hashFiles('**/Cargo.lock') }}-
+    - run: cargo install tauri-cli --force
+      # if we pull from cache, this will be skipped, but force just in case cache has an issue but it does exist
+      if: steps.cache_rust_bin.outputs.cache-hit != 'true' || steps.cache_rust_reg_index.outputs.cache-hit != 'true' || steps.cache_rust_reg_cache.outputs.cache-hit != 'true'
+    - name: cache node modules
+      uses: actions/cache@v1
+      with:
+        path: ${{ format('examples/{0}/node_modules', matrix.example) }}
+        key: ${{ runner.OS }}-build-${{ hashFiles(format('examples/{0}/yarn.lock', matrix.example)) }}
+        restore-keys: ${{ runner.OS }}-build-${{ env.cache-name }}-
+    - name: install via yarn
+      run: |
+           cd ./examples/${{ matrix.example }}
+           yarn
+    - name: build example
+      run: |
+           cd ./examples/${{ matrix.example }}
+           yarn build
+    - name: yarn tauri build
+      run: |
+           cd ./examples/${{ matrix.example }}
+           yarn tauri:prod:build

+ 11 - 76
.github/workflows/build-smoke-tests.yml → .github/workflows/smoke-tests-source.yml

@@ -1,80 +1,8 @@
-name: build smoke tests
+name: build smoke tests with source
 
 on: pull_request
 
 jobs:
-  via-prod:
-    runs-on: ${{ matrix.platform }}
-    timeout-minutes: 40
-
-    strategy:
-      fail-fast: false
-      matrix:
-        platform: [ubuntu-latest, macos-latest, windows-latest]
-        example: [react/gatsby-themed-site, vue/quasar-app]
-        include:
-          - platform: ubuntu-latest
-            CARGO_HOME: ~/.cargo
-          - platform: macos-latest
-            CARGO_HOME: ~/.cargo
-          - platform: windows-latest
-            CARGO_HOME: ~/.cargo
-
-    steps:
-    - uses: actions/checkout@v1
-      with:
-        fetch-depth: 3
-    - name: install rust stable
-      uses: actions-rs/toolchain@v1
-      with:
-          toolchain: stable
-    - name: install webkit2gtk (ubuntu only)
-      if: matrix.platform == 'ubuntu-latest'
-      run: |
-           sudo apt-get update
-           sudo apt-get install -y webkit2gtk-4.0
-    - name: cache rust bin
-      id: cache_rust_bin
-      uses: actions/cache@v1
-      with:
-        path: ${{ format('{0}/bin/', matrix.CARGO_HOME) }}
-        key: ${{ runner.OS }}-build-bin-${{ hashFiles('**/Cargo.lock') }}-
-    - name: cache rust registry/index
-      id: cache_rust_reg_index
-      uses: actions/cache@v1
-      with:
-        path: ${{ format('{0}/registry/index/', matrix.CARGO_HOME) }}
-        key: ${{ runner.OS }}-build-reg-index-${{ hashFiles('**/Cargo.lock') }}-
-    - name: cache rust registry/cache
-      id: cache_rust_reg_cache
-      uses: actions/cache@v1
-      with:
-        path: ${{ format('{0}/registry/cache/', matrix.CARGO_HOME) }}
-        key: ${{ runner.OS }}-build-reg-cache-${{ hashFiles('**/Cargo.lock') }}-
-    - run: cargo install tauri-cli --force
-      # if we pull from cache, this will be skipped, but force just in case cache has an issue but it does exist
-      if: steps.cache_rust_bin.outputs.cache-hit != 'true' || steps.cache_rust_reg_index.outputs.cache-hit != 'true' || steps.cache_rust_reg_cache.outputs.cache-hit != 'true'
-    - name: cache node modules
-      uses: actions/cache@v1
-      with:
-        path: ${{ format('examples/{0}/node_modules', matrix.example) }}
-        key: ${{ runner.OS }}-build-${{ hashFiles(format('examples/{0}/yarn.lock', matrix.example)) }}
-        restore-keys: ${{ runner.OS }}-build-${{ env.cache-name }}-
-    - name: install via yarn
-      run: |
-           cd ./examples/${{ matrix.example }}
-           yarn
-    - name: build example
-      env:
-        EXAMPLE_GATSBY_AIRTABLE_API_KEY: ${{ secrets.EXAMPLE_GATSBY_AIRTABLE_API_KEY }}
-      run: |
-           cd ./examples/${{ matrix.example }}
-           yarn build
-    - name: yarn tauri build
-      run: |
-           cd ./examples/${{ matrix.example }}
-           yarn tauri:prod:build
-
   via-source:
     runs-on: ${{ matrix.platform }}
     timeout-minutes: 40
@@ -86,7 +14,16 @@ jobs:
         example:
           - name : GatsbyThemedSite
             folder: react/gatsby-themed-site
-            executable: GatsbyThemedSiteApp
+            executable: gatsby-themed-site-app
+          - name : CRAApp
+            folder: react/create-react-app
+            executable: app
+          - name : NextjsApp
+            folder: react/next.js
+            executable: app
+          - name : VanillajsMonolithApp
+            folder: vanillajs/monolith
+            executable: app
           - name: quasar-app
             folder: vue/quasar-app
             executable: app
@@ -153,8 +90,6 @@ jobs:
            cd ./examples/${{ matrix.example.folder }}
            yarn
     - name: build example
-      env:
-        EXAMPLE_GATSBY_AIRTABLE_API_KEY: ${{ secrets.EXAMPLE_GATSBY_AIRTABLE_API_KEY }}
       run: |
            cd ./examples/${{ matrix.example.folder }}
            yarn build

+ 3 - 3
.github/workflows/test-on-pr.yml

@@ -3,7 +3,7 @@ name: test library
 on: pull_request
 
 jobs:
-  build-tauri:
+  build-tauri-core:
     runs-on: ${{ matrix.platform }}
 
     strategy:
@@ -32,7 +32,7 @@ jobs:
         TAURI_DIST_DIR: ../../test/fixture/dist
         TAURI_DIR: ../test/fixture/
 
-  build-tauri-cli:
+  build-tauri-bundler:
     runs-on: ${{ matrix.platform }}
 
     strategy:
@@ -53,7 +53,7 @@ jobs:
            cd ./cli/tauri-cli
            cargo build
 
-  test-tauri-js:
+  test-tauri-js-cli:
     runs-on: ${{ matrix.platform }}
 
     strategy:

+ 9 - 1
examples/react/create-react-app/package.json

@@ -13,7 +13,15 @@
   "scripts": {
     "start": "craco start",
     "build": "craco build",
-    "test": "craco test"
+    "test": "craco test",
+    "tauri:prod": "tauri",
+    "tauri:source": "node ../../../cli/tauri.js/bin/tauri",
+    "tauri:source:init": "yarn tauri:source init --tauriPath ../../../tauri",
+    "tauri:prod:init": "yarn tauri:prod init",
+    "tauri:source:dev": "yarn tauri:source dev",
+    "tauri:prod:dev": "yarn tauri:prod dev",
+    "tauri:source:build": "yarn tauri:source build",
+    "tauri:prod:build": "yarn tauri:prod build"
   },
   "eslintConfig": {
     "extends": "react-app"

+ 3 - 3
examples/react/gatsby-themed-site/src-tauri/Cargo.toml

@@ -1,13 +1,13 @@
 workspace = { }
 
 [package]
-name = "GatsbyThemedSiteApp"
+name = "gatsby-themed-site-app"
 version = "0.1.0"
 description = "Gatsby themed site built by Tauri"
 author = [ "you" ]
 license = ""
 repository = ""
-default-run = "GatsbyThemedSiteApp"
+default-run = "gatsby-themed-site-app"
 edition = "2018"
 
 [package.metadata.bundle]
@@ -37,5 +37,5 @@ dev-server = [ "tauri/dev-server" ]
 embedded-server = [ "tauri/embedded-server" ]
 
 [[bin]]
-name = "GatsbyThemedSiteApp"
+name = "gatsby-themed-site-app"
 path = "src/main.rs"

+ 9 - 1
examples/react/next.js/package.json

@@ -5,7 +5,15 @@
   "scripts": {
     "dev": "next dev",
     "build": "next build",
-    "start": "next start"
+    "start": "next start",
+    "tauri:prod": "tauri",
+    "tauri:source": "node ../../../cli/tauri.js/bin/tauri",
+    "tauri:source:init": "yarn tauri:source init --tauriPath ../../../tauri",
+    "tauri:prod:init": "yarn tauri:prod init",
+    "tauri:source:dev": "yarn tauri:source dev",
+    "tauri:prod:dev": "yarn tauri:prod dev",
+    "tauri:source:build": "yarn tauri:source build",
+    "tauri:prod:build": "yarn tauri:prod build"
   },
   "dependencies": {
     "next": "9.1.6",

+ 8 - 3
examples/vanillajs/monolith/package.json

@@ -6,9 +6,14 @@
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1",
     "html:dev": "quasar serve ./dist",
-    "tauri:init": "node node_modules/tauri/bin/tauri init",
-    "tauri:dev": "node node_modules/tauri/bin/tauri dev",
-    "tauri:build": "node node_modules/tauri/bin/tauri dev"
+    "tauri:prod": "tauri",
+    "tauri:source": "node ../../../cli/tauri.js/bin/tauri",
+    "tauri:source:init": "yarn tauri:source init --tauriPath ../../../tauri",
+    "tauri:prod:init": "yarn tauri:prod init",
+    "tauri:source:dev": "yarn tauri:source dev",
+    "tauri:prod:dev": "yarn tauri:prod dev",
+    "tauri:source:build": "yarn tauri:source build",
+    "tauri:prod:build": "yarn tauri:prod build"
   },
   "author": "",
   "license": "MIT",

+ 25 - 1
renovate.json

@@ -9,7 +9,7 @@
   },
   "packageRules": [
     {
-      "paths": ["examples/react/gatsby-themed-site"],
+      "paths": ["examples/react/gatsby**"],
       "groupName": "Gatsby Examples",
       "groupSlug": "allGatsby",
       "commitMessagePrefix": "chore(examples)",
@@ -20,6 +20,30 @@
       "automerge": true,
       "rebaseConflictedPrs": true
     },
+    {
+      "paths": ["examples/react/create-react-app**"],
+      "groupName": "CRA Examples",
+      "groupSlug": "allCRA",
+      "commitMessagePrefix": "chore(examples)",
+      "lockFileMaintenance": {
+        "enabled": true
+      },
+      "prPriority": -1,
+      "automerge": true,
+      "rebaseConflictedPrs": true
+    },
+    {
+      "paths": ["examples/react/next**"],
+      "groupName": "Next.js Examples",
+      "groupSlug": "allNextjs",
+      "commitMessagePrefix": "chore(examples)",
+      "lockFileMaintenance": {
+        "enabled": true
+      },
+      "prPriority": -1,
+      "automerge": true,
+      "rebaseConflictedPrs": true
+    },
     {
       "paths": ["examples/vue/**"],
       "groupName": "Vue Examples",