diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index 3161d56..a26724b 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -77,3 +77,37 @@ jobs: update_existing: true search_existing: open filename: .github/AUTO_ISSUE_TEMPLATE/daily-checking-fail.md + + + setup-bleeding: + strategy: + fail-fast: false + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + + runs-on: ${{ matrix.os }} + name: Setup Bleeding@${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Moonbit + uses: hustcer/setup-moonbit@v1 + with: + version: bleeding + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check Moonbit Version + run: | + moon version --all + + - name: Create an Issue for Release Failure + if: ${{ failure() }} + uses: JasonEtco/create-an-issue@v2.9.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + update_existing: true + search_existing: open + filename: .github/AUTO_ISSUE_TEMPLATE/daily-checking-fail.md diff --git a/README.md b/README.md index 3c82b87..272b702 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ In rare circumstances you might get rate limiting errors, if this happens you ca | Name | Required | Description | Type | Default | | ------------ | -------- | ------------ | ------ | --------- | -| `version` | no | A valid moonbit tool chain version, such as `0.1.20241104+8ce5d2967`, `nightly` , etc. or `bleeding` (currently for macOS only) | string | `latest`| +| `version` | no | A valid moonbit tool chain version, such as `0.1.20241104+8ce5d2967`, `nightly` , etc. or `bleeding` | string | `latest`| | `setup-core` | no | `true` to download and bundle Moonbit Core, `false` to ignore it | bool | `true` | ## License diff --git a/README.zh-CN.md b/README.zh-CN.md index d072e50..775adc3 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -37,7 +37,7 @@ steps: | 参数名 | 必填 | 描述 | 类型 | 默认值 | | ---------------- | -------- | --- | ------ | --------- | -| `version` | 否 | 合法的 Moonbit 工具链版本,比如: `0.1.20241104+8ce5d2967`, `nightly` 或者 `bleeding` (只支持 macOS) | string | `latest` | +| `version` | 否 | 合法的 Moonbit 工具链版本,比如: `0.1.20241104+8ce5d2967`, `nightly` 或者 `bleeding` | string | `latest` | | `setup-core` | 否 | 设置为 `true` 则下载并打包 Moonbit Core, `false` 则忽略 | bool | `true` | ## 许可 diff --git a/nu/moonbit.nu b/nu/moonbit.nu index ad67407..4f8ca0c 100644 --- a/nu/moonbit.nu +++ b/nu/moonbit.nu @@ -57,12 +57,14 @@ export def 'setup moonbit' [ ] { let MOONBIT_BIN_DIR = [$nu.home-path .moon bin] | path join let MOONBIT_LIB_DIR = [$nu.home-path .moon lib] | path join + let coreDir = $'($MOONBIT_LIB_DIR)/core' if not ($MOONBIT_BIN_DIR | path exists) { mkdir $MOONBIT_BIN_DIR; } if not ($MOONBIT_LIB_DIR | path exists) { mkdir $MOONBIT_LIB_DIR; } cd $MOONBIT_BIN_DIR let OS_INFO = $'($nu.os-info.name)_($nu.os-info.arch)' let archive = $ARCH_TARGET_MAP | get -i $OS_INFO + let moonBin = if (windows?) { 'moon.exe' } else { 'moon' } if ($archive | is-empty) { print $'Unsupported Platform: ($OS_INFO)'; exit 2 } print $'(char nl)Setup moonbit toolchain of version: (ansi g)($version)(ansi reset)'; hr-line @@ -99,21 +101,22 @@ export def 'setup moonbit' [ print $'(char nl)Setup moonbit core of version: (ansi g)($version)(ansi reset)'; hr-line cd $MOONBIT_LIB_DIR; rm -rf ./core/* if $version == 'bleeding' { - git clone --depth 1 https://github.com/moonbitlang/core.git $'($MOONBIT_LIB_DIR)/core' - moon bundle --all --source-dir $'($MOONBIT_LIB_DIR)/core' - moon bundle --target wasm-gc --source-dir $'($MOONBIT_LIB_DIR)/core' --quiet + if ($coreDir | path exists) { rm -rf $coreDir } + git clone --depth 1 https://github.com/moonbitlang/core.git $coreDir + ^$moonBin bundle --all --source-dir $coreDir + ^$moonBin bundle --target wasm-gc --source-dir $coreDir --quiet return } fetch-core $version - let moonBin = if (windows?) { 'moon.exe' } else { 'moon' } + if (windows?) { unzip -q core*.zip -d $MOONBIT_LIB_DIR; rm core*.zip } else { tar xf core*.tar.gz --directory $MOONBIT_LIB_DIR; rm core*.tar.gz } - ^$moonBin bundle --all --source-dir $'($MOONBIT_LIB_DIR)/core' - ^$moonBin bundle --target wasm-gc --source-dir $'($MOONBIT_LIB_DIR)/core' --quiet + ^$moonBin bundle --all --source-dir $coreDir + ^$moonBin bundle --target wasm-gc --source-dir $coreDir --quiet } }