Skip to content

Commit

Permalink
feat: Add bleeding test workflow (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcer authored Nov 9, 2024
1 parent 56fd305 commit 12fb2a5
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 8 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
update_existing: true
search_existing: open
filename: .github/AUTO_ISSUE_TEMPLATE/daily-checking-fail.md
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |

## 许可
Expand Down
15 changes: 9 additions & 6 deletions nu/moonbit.nu
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit 12fb2a5

Please sign in to comment.