Skip to content

Commit

Permalink
feat: 添加测试脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
KonghaYao committed Dec 28, 2024
1 parent 4d9860c commit 9a938d8
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 96 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/cross-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
description: 'Version number'
required: true
default: '7.0.0-beta-6'
dryRun:
description: '测试写这个为 true'
required: true
default: 'false'
env:
CARGO_PKG_VERSION: ${{ github.event.inputs.version }}

Expand Down Expand Up @@ -198,6 +202,7 @@ jobs:
path: ./target/wasm32-wasip1/release/libffi-wasm32-wasip1.wasm
if-no-files-found: error
create-release:
if: ${{ github.event.inputs.dryRun != 'true' }}
runs-on: ubuntu-latest
needs: [build-wasm, cross-build]
steps:
Expand Down
128 changes: 128 additions & 0 deletions .github/workflows/test-cross-use.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: test-cross-use
on:
workflow_dispatch:
inputs:
dryRun:
description: '测试写这个为 true'
required: true
default: 'false'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
cross-:
name: Test - ${{ matrix.platform.os-name }}
strategy:
fail-fast: false
matrix:
platform:
- os-name: FreeBSD-x86_64
runs-on: ubuntu-24.04
target: x86_64-unknown-freebsd

- os-name: aarch64-unknown-linux-gnu
runs-on: ubuntu-24.04
target: aarch64-unknown-linux-gnu

- os-name: x86_64-unknown-linux-gnu
runs-on: ubuntu-24.04
target: x86_64-unknown-linux-gnu

# - os-name: Linux-x86_64-musl
# runs-on: ubuntu-20.04
# target: x86_64-unknown-linux-musl

# - os-name: Linux-aarch64-musl
# runs-on: ubuntu-20.04
# target: aarch64-unknown-linux-musl

- os-name: Linux-riscv64
runs-on: ubuntu-20.04
target: riscv64gc-unknown-linux-gnu

- os-name: Linux-s390x
runs-on: ubuntu-20.04
target: s390x-unknown-linux-gnu

- os-name: Windows-x86_64-msvc
runs-on: windows-latest
target: x86_64-pc-windows-msvc

- os-name: Windows-x86_64-aarch64
runs-on: windows-latest
target: aarch64-pc-windows-msvc

- os-name: Windows-x86_64-gnu
runs-on: windows-latest
target: x86_64-pc-windows-gnu

- os-name: macOS-x86_64
runs-on: macOS-latest
target: x86_64-apple-darwin

- os-name: macOS-aarch64
runs-on: macOS-latest
target: aarch64-apple-darwin

# more targets here ...
env:
TZ: Asia/Shanghai
runs-on: ${{ matrix.platform.runs-on }}
steps:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: |
npm install cn-font-split -g
cn-font-split ls
- name: Create index.mjs file
if: ${{ runner.os != 'Windows' }}
run: |
cat > index.mjs <<EOL
import unzipper from "unzipper";
fetch(
"https://github.com/atelier-anchor/smiley-sans/releases/download/v2.0.1/smiley-sans-v2.0.1.zip"
)
.then((res) => res.arrayBuffer())
.then(async (res) => {
const directory = await unzipper.Open.buffer(Buffer.from(res));
await directory.extract({ path: "./" });
});
EOL
- name: Create index.mjs file
if: ${{ runner.os == 'Windows' }}
run: |
$content = @'
import unzipper from "unzipper";
fetch(
"https://github.com/atelier-anchor/smiley-sans/releases/download/v2.0.1/smiley-sans-v2.0.1.zip"
)
.then((res) => res.arrayBuffer())
.then(async (res) => {
const directory = await unzipper.Open.buffer(Buffer.from(res));
await directory.extract({ path: "./" });
});
'@
Set-Content -Path index.mjs -Value $content
- name: Install unzipper
run: |
npm init -y
npm install unzipper
node index.mjs
- name: build
run: |
cn-font-split -i ./SmileySans-Oblique.otf -o ./dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: test-${{ matrix.platform.target }}-${{hashFiles('dist/**/*.woff2')}}
path: ./dist/**/*
if-no-files-found: error
14 changes: 7 additions & 7 deletions .github/workflows/test-font-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ on:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
runs-on: macOS-latest
container:
image: mcr.microsoft.com/playwright:v1.49.1-noble
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: pnpm install

- name: Install Playwright browsers
run: npx playwright install --with-deps
run: |
npm install pnpm -g
pnpm install
- name: Cache fonts
id: cache-fonts
Expand Down
6 changes: 3 additions & 3 deletions packages/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@cn-ui/reactive": "^2.3.0",
"@grpc/grpc-js": "^1.12.2",
"@grpc/grpc-js": "^1.12.5",
"google-protobuf": "^3.21.4",
"gzip": "^0.1.0",
"jszip": "^3.10.1",
Expand All @@ -20,12 +20,12 @@
"pngjs": "^7.0.0",
"protobufjs": "^7.4.0",
"shelljs": "^0.8.5",
"solid-js": "^1.8.17",
"solid-js": "^1.9.3",
"solidjs-use": "^2.3.0"
},
"devDependencies": {
"@napi-rs/woff-build": "^0.2.0",
"@playwright/test": "^1.44.1",
"@playwright/test": "^1.49.1",
"@types/pixelmatch": "^5.2.6",
"@types/pngjs": "^6.0.5",
"@types/shelljs": "^0.8.15",
Expand Down
Loading

0 comments on commit 9a938d8

Please sign in to comment.