From 4f9d2e2ba72b4bf50fb76f79ebeb7c229e93da82 Mon Sep 17 00:00:00 2001 From: Jacob Bolda Date: Sat, 21 Dec 2019 03:47:33 -0600 Subject: [PATCH] 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 --- .github/workflows/smoke-test-prod.yml | 76 ++++++++++++++++ ...smoke-tests.yml => smoke-tests-source.yml} | 87 +++---------------- .github/workflows/test-on-pr.yml | 6 +- examples/react/create-react-app/package.json | 10 ++- .../gatsby-themed-site/src-tauri/Cargo.toml | 6 +- examples/react/next.js/package.json | 10 ++- examples/vanillajs/monolith/package.json | 11 ++- renovate.json | 26 +++++- 8 files changed, 144 insertions(+), 88 deletions(-) create mode 100644 .github/workflows/smoke-test-prod.yml rename .github/workflows/{build-smoke-tests.yml => smoke-tests-source.yml} (52%) diff --git a/.github/workflows/smoke-test-prod.yml b/.github/workflows/smoke-test-prod.yml new file mode 100644 index 000000000..a7e74ec75 --- /dev/null +++ b/.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 diff --git a/.github/workflows/build-smoke-tests.yml b/.github/workflows/smoke-tests-source.yml similarity index 52% rename from .github/workflows/build-smoke-tests.yml rename to .github/workflows/smoke-tests-source.yml index 05d0a0b9c..f173e9529 100644 --- a/.github/workflows/build-smoke-tests.yml +++ b/.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 diff --git a/.github/workflows/test-on-pr.yml b/.github/workflows/test-on-pr.yml index 901907b98..c0fc56376 100644 --- a/.github/workflows/test-on-pr.yml +++ b/.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: diff --git a/examples/react/create-react-app/package.json b/examples/react/create-react-app/package.json index 7d32c9fba..0ba478ba4 100644 --- a/examples/react/create-react-app/package.json +++ b/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" diff --git a/examples/react/gatsby-themed-site/src-tauri/Cargo.toml b/examples/react/gatsby-themed-site/src-tauri/Cargo.toml index 51c1cdb0d..1ab90cc45 100644 --- a/examples/react/gatsby-themed-site/src-tauri/Cargo.toml +++ b/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" diff --git a/examples/react/next.js/package.json b/examples/react/next.js/package.json index 0dca03cae..1409916f3 100644 --- a/examples/react/next.js/package.json +++ b/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", diff --git a/examples/vanillajs/monolith/package.json b/examples/vanillajs/monolith/package.json index 1a6e8e5b5..d11ddda66 100644 --- a/examples/vanillajs/monolith/package.json +++ b/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", diff --git a/renovate.json b/renovate.json index fc586bbd0..2faf2860f 100644 --- a/renovate.json +++ b/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",