Skip to content

Commit

Permalink
Merge branch 'master' into fix/1478
Browse files Browse the repository at this point in the history
  • Loading branch information
jeasonnow committed Aug 26, 2024
2 parents 667268e + e6cfc86 commit 70f4582
Show file tree
Hide file tree
Showing 57 changed files with 721 additions and 447 deletions.
2 changes: 2 additions & 0 deletions .github/actions-rs/grcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
output-type: lcov
output-file: ./lcov.info
114 changes: 48 additions & 66 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,50 @@
# Run cargo-llvm-cov and upload to codecov.io

# name: Code Coverage

# on:
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]
# types: [ opened, synchronize ]

# # Cancel prev CI if new commit
# concurrency:
# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# cancel-in-progress: true

# permissions:
# contents: read

# jobs:
# coverage:
# name: Code Coverage
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# override: true

# - name: Install cargo-llvm-cov
# uses: taiki-e/install-action@cargo-llvm-cov

# - name: Install cargo-nextest
# uses: taiki-e/install-action@cargo-nextest

# - name: Install llvm-tools-preview for llvm-cov
# run: rustup component add llvm-tools-preview

# - name: Run
# run: cargo codecov --lcov --output-path lcov.info

# - name: Upload Artifact
# uses: actions/upload-artifact@v3
# with:
# name: codecov
# path: lcov.info

# codecov often fails, use another workflow for retry
# upload-codecov:
# name: Upload coverage file
# runs-on: ubuntu-latest
# needs: coverage
# steps:
# - name: Checkout
# uses: actions/checkout@v3

# - name: Download coverage file
# uses: actions/download-artifact@v3
# with:
# name: codecov

# - name: Upload to codecov.io
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# fail_ci_if_error: true
# files: lcov.info
name: Code Coverage

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
types: [ opened, synchronize ]

# Cancel prev CI if new commit
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
- name: Run tests
run: cargo test -p mako
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cllvm-args=--inline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
- name: rust-grcov
# You may pin to the exact commit or the version.
# uses: actions-rs/grcov@bb47b1ed7883a1502fa6875d562727ace2511248
uses: actions-rs/grcov@v0.1
- name: Codecov
# You may pin to the exact commit or the version.
# uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
# Repository upload token - get it from codecov.io. Required only for private repositories
# token: # optional
# Specify whether the Codecov output should be verbose
verbose: true
fail_ci_if_error: true
118 changes: 46 additions & 72 deletions .github/workflows/node-bind-build.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: node-bind-build
env:
DEBUG: napi:*
APP_NAME: okam
APP_NAME: mako
MACOSX_DEPLOYMENT_TARGET: '10.13'
'on':
on:
workflow_dispatch:
push:
branches:
- master
Expand All @@ -16,61 +17,52 @@ env:
- .editorconfig
- docs/**
pull_request:
types: [opened, synchronize]
types: [ opened, synchronize ]
jobs:
pre-check:
name: Check Is Release node-binding
if: "contains(github.event.head_commit.message, 'Release')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: is Release Commit
run: |
echo Start Release
if git log -1 --pretty=%B | grep "^Release [0-9]\+\.[0-9]\+\.[0-9]\+"; then
echo "start Release"
else
gh run cancel ${{ github.run_id }}
gh run watch ${{ github.run_id }}
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
needs:
- pre-check
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
build: |
pnpm --filter @okamjs/okam build --target x86_64-apple-darwin
rustup target add x86_64-apple-darwin
pnpm --filter @umijs/mako build --target x86_64-apple-darwin
strip -x ./packages/mako/*.node
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: |-
set -e &&
pnpm --filter @okamjs/okam build --target x86_64-unknown-linux-gnu &&
pnpm --filter @umijs/mako build --target x86_64-unknown-linux-gnu &&
strip ./packages/mako/*.node
- host: macos-latest
target: aarch64-apple-darwin
build: |
rustup target add aarch64-apple-darwin
pnpm --filter @okamjs/okam build --target aarch64-apple-darwin
pnpm --filter @umijs/mako build --target aarch64-apple-darwin
strip -x ./packages/mako/*.node
name: stable - ${{ matrix.settings.target }} - node@18
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |
pnpm --filter @umijs/mako build --target x86_64-unknown-linux-musl
strip -x ./packages/mako/*.node
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |-
set -e &&
rustup target add aarch64-unknown-linux-musl &&
pnpm --filter @umijs/mako build --target aarch64-unknown-linux-musl
name: stable - ${{ matrix.settings.target }} - node@20
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
if: ${{ !matrix.settings.docker }}
with:
node-version: 18
Expand All @@ -83,7 +75,7 @@ jobs:
toolchain: stable
targets: ${{ matrix.settings.target }}
- name: Cache cargo
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
Expand All @@ -100,10 +92,6 @@ jobs:
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: Setup node x86
if: matrix.settings.target == 'i686-pc-windows-msvc'
run: yarn config set supportedArchitectures.cpu "ia32"
shell: bash
- name: Install dependencies
run: pnpm install
- name: Setup node x86
Expand All @@ -126,49 +114,35 @@ jobs:
if: ${{ !matrix.settings.docker }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: ./packaegs/mako/${{ env.APP_NAME }}.*.node
path: ./packages/mako/*.node
if-no-files-found: error
publish:
name: Publish
zip:
name: Zip
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
check-latest: true
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Download all artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: packaegs/mako/artifacts
- name: Move artifacts
run: pnpm --filter @okamjs/okam artifacts
path: ./
merge-multiple: true
- name: List packages
run: ls -R ./packaegs/mako/npm
run: ls *.node
shell: bash

- name: Publish
run: |
if git log -1 --pretty=%B | grep "^Release [0-9]\+\.[0-9]\+\.[0-9]\+"; then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
pnpm --filter @okamjs/okam publish --access public
else
echo "Not a release, skipping publish"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Upload Zip file
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/upload-artifact@v4
with:
path: mako.*.node
name: artifacts-${{ github.sha }}
- name: Upload Zip file CI
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: actions/upload-artifact@v4
with:
path: mako.*.node
name: artifacts-${{ github.event.pull_request.head.sha }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.8.4

`2024-08-23`

- fix: should not alias define XXX to process.env.XXX by [@xusd320](https://github.com/xusd320) in [#1504](https://github.com/umijs/mako/pull/1526)

## 0.8.2

`2024-08-16`
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG_zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.8.4

`2024-08-23`

- 修复 bundler-mako 中 define process.env.XXX 不生效的问题 by [@xusd320](https://github.com/xusd320) in [#1504](https://github.com/umijs/mako/pull/1526)

## 0.8.2

`2024-08-16`
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ $ OKAM=/PATH/TO/umijs/marko/packages/bundler-mako/index.js bigfish build
```

Performance analysis with [Xcode instruments](https://help.apple.com/instruments/mac) in umi or bigfish.

```bash
$ XCODE_PROFILE=1 OKAM=/PATH/TO/umijs/marko/packages/bundler-mako/index.js umi build
$ XCODE_PROFILE=1 OKAM=/PATH/TO/umijs/marko/packages/bundler-mako/index.js umi dev
Expand Down
Loading

0 comments on commit 70f4582

Please sign in to comment.