Skip to content

Commit

Permalink
feat(cli.rs): add tests to node binding, delete cli.js (#3381)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Co-authored-by: LongYinan <lynweklm@gmail.com>
  • Loading branch information
lucasfernog and Brooooooklyn committed Feb 10, 2022
1 parent 8562706 commit 2403e73
Show file tree
Hide file tree
Showing 84 changed files with 2,722 additions and 8,491 deletions.
124 changes: 49 additions & 75 deletions .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ env:
DEBUG: napi:*
APP_NAME: cli
MACOSX_DEPLOYMENT_TARGET: '10.13'
'on':
on:
workflow_dispatch:
repository_dispatch:
types: [publish-clijs]
Expand Down Expand Up @@ -184,6 +184,8 @@ jobs:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: 'x86_64-apple-darwin'
- host: windows-latest
target: x86_64-pc-windows-msvc
node:
Expand Down Expand Up @@ -243,6 +245,10 @@ jobs:
- name: List packages
run: ls -R .
shell: bash
- name: install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: Test bindings
run: yarn test
test-linux-x64-musl-binding:
Expand All @@ -257,6 +263,8 @@ jobs:
- '14'
- '16'
runs-on: ubuntu-latest
container:
image: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
steps:
- uses: actions/checkout@v2
- name: Setup node
Expand All @@ -276,10 +284,22 @@ jobs:
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-alpine sh -c "yarn test"
test-linux-aarch64-gnu-binding:
name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }}
- name: Install system dependencies
run: |
apk add openssl-dev musl-dev glib-dev cairo-dev pkgconfig gdk-pixbuf-dev webkit2gtk-dev curl libappindicator-dev patchelf librsvg-dev gtk+3.0-dev
- name: Setup and run tests
run: |
yarn tauri --help
ls -la
# TODO: fix this test: https://github.com/tauri-apps/tauri/runs/5145729140?check_suite_focus=true#step:9:704
#- name: Setup and run tests
# run: |
# rustup install stable
# rustup default stable
# yarn test
# ls -la
test-linux-arm-bindings:
name: Test bindings on ${{ matrix.image }} - node@${{ matrix.node }}
needs:
- build
strategy:
Expand All @@ -289,92 +309,48 @@ jobs:
- '12'
- '14'
- '16'
image:
- ghcr.io/napi-rs/napi-rs/nodejs:aarch64-16
- ghcr.io/napi-rs/napi-rs/nodejs:armhf-16
runs-on: ubuntu-latest
steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
working-directory: ${{ github.workspace }}
- uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: bindings-aarch64-unknown-linux-gnu
path: 'tooling/cli.rs/node/'
- name: List packages
run: ls -R .
shell: bash
- name: Install dependencies
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Setup and run tests
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/napi-rs/napi-rs/nodejs:aarch64-${{ matrix.node }}
options: '-v ${{ github.workspace }}:/build -w /build'
run: |
set -e
sh -c "cd tooling/cli.rs/node && yarn test"
ls -la
test-linux-aarch64-musl-binding:
name: Test bindings on aarch64-unknown-linux-musl - node@${{ matrix.node }}
needs:
- build
runs-on: ubuntu-latest
steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
working-directory: ${{ github.workspace }}
- uses: actions/checkout@v2
- name: Download artifacts
- name: Download aarch64-gnu artifacts
uses: actions/download-artifact@v2
with:
name: bindings-aarch64-unknown-linux-musl
name: bindings-aarch64-unknown-linux-gnu
path: 'tooling/cli.rs/node/'
- name: List packages
run: ls -R .
shell: bash
- name: Install dependencies
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Setup and run tests
uses: addnab/docker-run-action@v3
with:
image: multiarch/alpine:aarch64-latest-stable
options: '-v ${{ github.workspace }}:/build -w /build'
run: |
set -e
apk add nodejs npm yarn
sh -c "cd tooling/cli.rs/node && yarn test"
test-linux-arm-gnueabihf-binding:
name: Test bindings on armv7-unknown-linux-gnueabihf - node@${{ matrix.node }}
needs:
- build
strategy:
fail-fast: false
matrix:
node:
- '12'
- '14'
- '16'
runs-on: ubuntu-latest
steps:
- run: docker run --rm --privileged multiarch/qemu-user-static:register --reset
working-directory: ${{ github.workspace }}
- uses: actions/checkout@v2
- name: Download artifacts
- name: Download armv7-gnueabihf artifacts
uses: actions/download-artifact@v2
with:
name: bindings-armv7-unknown-linux-gnueabihf
path: 'tooling/cli.rs/node/'
- name: List packages
run: ls -R .
shell: bash
- name: Install dependencies
run: yarn install --ignore-scripts --ignore-platform --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
- name: Setup and run tests
uses: addnab/docker-run-action@v3
# TODO: actually run test, blocked by https://github.com/rust-lang/cargo/issues/8719
- uses: addnab/docker-run-action@v3
with:
image: ghcr.io/napi-rs/napi-rs/nodejs:armhf-${{ matrix.node }}
options: '-v ${{ github.workspace }}:/build -w /build'
image: ${{ matrix.image }}
options: '-v ${{ github.workspace }}:/build -w /build -e RUSTUP_HOME=/usr/local/rustup -e CARGO_HOME=/usr/local/cargo'
shell: bash
run: |
set -e
sh -c "cd tooling/cli.rs/node && yarn test"
export PATH=/usr/local/cargo/bin/:/usr/local/fnm:$PATH
apt-get update
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install --no-install-recommends -y unzip libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
bash
curl https://sh.rustup.rs -sSf | bash -s -- -y
curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "/usr/local/fnm" --skip-shell
eval "$(fnm env --use-on-cd)"
fnm install ${{ matrix.node }}
fnm use ${{ matrix.node }}
cd tooling/cli.rs/node
yarn tauri --help
ls -la
publish:
name: Publish
Expand All @@ -383,10 +359,8 @@ jobs:
#- build-freebsd
- test-macOS-windows-binding
- test-linux-x64-gnu-binding
#- test-linux-x64-musl-binding
#- test-linux-aarch64-gnu-binding
#- test-linux-aarch64-musl-binding
#- test-linux-arm-gnueabihf-binding
- test-linux-x64-musl-binding
#- test-linux-arm-bindings
steps:
- uses: actions/checkout@v2
- name: Setup node
Expand Down
18 changes: 1 addition & 17 deletions core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,7 @@ impl Default for PatternKind {

/// The Tauri configuration object.
#[skip_serializing_none]
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct TauriConfig {
Expand Down Expand Up @@ -1509,22 +1509,6 @@ pub struct TauriConfig {
pub macos_private_api: bool,
}

impl Default for TauriConfig {
fn default() -> Self {
Self {
pattern: Default::default(),
windows: Default::default(),
cli: None,
bundle: BundleConfig::default(),
allowlist: AllowlistConfig::default(),
security: SecurityConfig::default(),
updater: UpdaterConfig::default(),
system_tray: None,
macos_private_api: false,
}
}
}

impl TauriConfig {
/// Returns all Cargo features.
#[allow(dead_code)]
Expand Down
Loading

0 comments on commit 2403e73

Please sign in to comment.