Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DONT REVIEW #6

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 26 additions & 39 deletions .github/workflows/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@ env:
GITHUB_ACTION_RUN_ID: ${{ github.run_id }}
GITHUB_ACTION_RUN_NUMBER: ${{ github.run_number }}

permissions:
contents: write
pull-requests: write
actions: write # 用于上传/下载 artifacts

jobs:
test:
collect-data:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand All @@ -32,11 +39,19 @@ jobs:
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
path: ~/.cargo/registry
- name: install MoonBit

- name: install MoonBit(Unix)
if: ${{ matrix.os != 'windows-latest' }}
run: |
curl -fsSLv https://cli.moonbitlang.com/install/unix.sh | bash -s
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> $GITHUB_PATH

- name: install MoonBit(Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser; irm https://cli.moonbitlang.com/install/powershell.ps1 | iex
"C:\Users\runneradmin\.moon\bin" | Out-File -FilePath $env:GITHUB_PATH -Append

- name: Version
run: moon version --all

Expand All @@ -50,42 +65,14 @@ jobs:
env UPDATE_EXPECT=1 cargo test
./target/release/moon_dashboard stat --file repos.txt

- name: Commit
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add ./webapp/public/*.gz
git add ./repos.txt
git commit -m "Update data" || echo "No changes to commit"

- name: Push changes
run: git push

- name: Setup Node.js 22
uses: actions/setup-node@v4
- name: Upload data
uses: actions/upload-artifact@v4
with:
node-version: '22'

- name: Install pnpm
run: npm install -g pnpm
name: data-${{ matrix.os }}
path: |
${{ matrix.os == 'macos-latest' && './webapp/public/mac/latest_data.jsonl.gz' ||
matrix.os == 'windows-latest' && './webapp/public/windows/latest_data.jsonl.gz' ||
'./webapp/public/linux/latest_data.jsonl.gz' }}
if-no-files-found: error

- name: pnpm install
run: pnpm install
working-directory: ./webapp

- name: pnpm run build
run: |
pnpm run build
sed -i '' 's|="/assets|="/moon-build-dashboard/assets|g' ./dist/index.html
sed -i '' 's|"/latest_data.jsonl.gz"|"/moon-build-dashboard/latest_data.jsonl.gz"|g' ./dist/assets/*.js
working-directory: ./webapp

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./webapp/dist
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
force_orphan: true
140 changes: 0 additions & 140 deletions repos.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
https://github.com/moonbitlang/core main
https://github.com/moonbitlang/x main
https://github.com/gmlewis/moonbit-fonts master
https://github.com/trancee/wasmSID main
https://github.com/moonbitlang/minimoonbit-public main

# generated list to test mooncakes on mooncakes.io
A-23187/encoding 0.1.0
CAIMEOX/feat-moon 0.2.0
Expand All @@ -14,139 +10,3 @@ CAIMEOX/t 0.1.0
CMoonBack/Binary-Exponentiation 0.1.0
CMoonBack/computational-geometry 0.1.0
CMoonBack/string-Algorithm 0.1.0
Guest0x0/HAMT 0.2.1
Guest0x0/dregex 0.2.5
Howardzhangdqs/md5 0.9.3
Kaida-Amethyst/math 0.1.4
Lampese/moonbit-chalk 0.3.2
PegasusPlusUS/hello 0.1.0
PerfectPan/base64 0.1.1
SyoujyoujiNaiki/chungshan 0.2.0
Yoorkin/ArgParser 0.1.7
Yoorkin/example/list 0.1.4
Yoorkin/format 0.1.5
Yoorkin/hello 0.1.3
Yoorkin/prettyprinter 0.4.0
Yoorkin/rabbit-tea 0.2.8
Yoorkin/stack 0.1.4
Yoorkin/trie 0.2.2
Yu-zh/either 0.1.0
YumeCross/schema 0.4.3
bob/aegis 0.1.0
bobzhang/sexp 0.1.1
bobzhang/testa 0.1.0
bobzhang/testb 0.1.0
bzy-debug/cowsay 0.1.0
bzy-debug/cowsay_lib 0.1.0
bzy-debug/hello 0.1.20240510+81e045f4e
chawyehsu/punycode 0.0.3
eczn/eczn-utils 0.2.0
enjoecn/easy 0.1.0
enjoecn/gb 0.1.1
extism/moonbit-pdk 0.36.0
fantix/mmhttp 0.3.0
fantix/muts 0.5.4
five-nuts/coreutils 0.1.3
gmlewis/b2 0.27.0
gmlewis/base64 0.11.0
gmlewis/crc32 0.6.0
gmlewis/flate 0.31.0
gmlewis/fonts 0.2.0
gmlewis/fonts-a 0.2.0
gmlewis/fonts-b 0.2.0
gmlewis/fonts-c 0.2.0
gmlewis/fonts-d 0.2.0
gmlewis/fonts-e 0.2.0
gmlewis/fonts-f 0.2.0
gmlewis/fonts-g 0.2.0
gmlewis/fonts-h 0.2.0
gmlewis/fonts-i 0.2.0
gmlewis/fonts-j 0.2.0
gmlewis/fonts-k 0.2.0
gmlewis/fonts-l 0.2.0
gmlewis/fonts-m 0.2.0
gmlewis/fonts-o 0.2.0
gmlewis/fonts-p 0.2.0
gmlewis/fonts-q 0.2.0
gmlewis/fonts-r 0.2.0
gmlewis/fonts-s 0.2.0
gmlewis/fonts-t 0.2.0
gmlewis/fonts-u 0.2.0
gmlewis/fonts-v 0.2.0
gmlewis/fonts-w 0.2.0
gmlewis/fonts-y 0.2.0
gmlewis/fonts-z 0.2.0
gmlewis/gzip 0.25.0
gmlewis/hash 0.14.0
gmlewis/image 0.12.0
gmlewis/io 0.16.0
gmlewis/json 0.15.0
gmlewis/jsonutil 0.24.0
gmlewis/md5 0.15.0
gmlewis/moonbit-pdk 0.44.0
gmlewis/sha1 0.6.0
gmlewis/sha256 0.13.0
gmlewis/spin-moonbit-sdk 0.45.0
gmlewis/zlib 0.14.0
hackwaly/common 0.1.24
hackwaly/moonyacc 0.1.11
jankin_li/Learn_Test1 0.1.0
jankin_li/new_lib 0.1.0
jedisct1/aegis 0.2.1
jumpping/baby 0.2.0
kinoamyfx/moon-axe-tools 0.0.1-SNAPSHOT
lijunchen/unstable_io 0.1.3
loneoutpost/core-extra 0.0.6
lucifer1004/mooncake 0.1.0
mizchi/js_io 0.1.1
mizchi/js_regexp 0.0.4
mizchi/json 0.4.0
mizchi/protocol 0.0.5
moonbit-courses/minimoonbit-courses 0.1.0
moonbit-js-ffi/js 0.2.0
moonbitlang/arduino 0.0.1
moonbitlang/core 0.1.20241209+f9fa7f5b2
moonbitlang/quickcheck 0.6.9
moonbitlang/std 0.1.0
moonbitlang/wasm4 0.2.4
moonbitlang/x 0.4.13
myfreess/myers-diff 0.1.0
oboard/mimetype 0.1.4
oboard/mocket 0.2.0
oboard/moonbit-eval 0.1.5
oboard/mooncrypto 0.1.8
oboard/moonetx 0.1.5
oboard/numoon 0.3.2
peter-jerry-ye/advent_of_code 0.3.1-fix
peter-jerry-ye/assertion 0.2.1
peter-jerry-ye/canvas 0.4.0
peter-jerry-ye/json 0.4.0
peter-jerry-ye/memory 0.8.4
peter-jerry-ye/parser-combinator 0.9.1
peter-jerry-ye/utils 0.1.0
peter-jerry-ye/wasi 0.18.0
rami3l/cmark 0.1.5
suiyunonghen/datetime 0.1.3
suiyunonghen/linklist 0.1.7
suiyunonghen/moonvalue 0.1.9
suiyunonghen/wasmMemManager 0.1.2
summer-boythink/moonorm 0.1.0
tiye/cirru-edn 0.0.3
tiye/cirru-parser 0.0.9
tiye/dom-ffi 0.0.6
tiye/lexicon-fractional-index 0.0.2
tiye/respo 0.0.19
tmkx/hello 0.0.0
tonyfettes/memory 0.1.5
tonyfettes/narray 0.1.0
tonyfettes/torch 0.2.5
wangziling/hello 0.0.1
wstreet/moontest 0.1.0
xunyoyo/linalg 0.2.5
xunyoyo/permutation 0.1.3
yamajik/dapr 0.1.9
yamajik/wasi 0.1.23
yamajik/wasi-bindings 0.2.1
yangqing/hello 0.2.2
yj-qin/regexp 0.3.2
zxch3n/expect 0.3.1
30 changes: 15 additions & 15 deletions src/auto_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ use crate::mooncakesio::get_all_mooncakes;

#[test]
fn gen_latest_list_with_version() {
let repos = std::fs::read_to_string("repos.txt").unwrap();
let parts: Vec<&str> = repos
.splitn(2, "# generated list to test mooncakes on mooncakes.io")
.collect();
// let repos = std::fs::read_to_string("repos.txt").unwrap();
// let parts: Vec<&str> = repos
// .splitn(2, "# generated list to test mooncakes on mooncakes.io")
// .collect();

let mut mooncakesio = String::new();
let db = get_all_mooncakes().unwrap();
for (name, versions) in db.db {
let latest_version = versions.last().unwrap();
mooncakesio.push_str(&format!("{} {}\n", name, latest_version));
}
// let mut mooncakesio = String::new();
// let db = get_all_mooncakes().unwrap();
// for (name, versions) in db.db {
// let latest_version = versions.last().unwrap();
// mooncakesio.push_str(&format!("{} {}\n", name, latest_version));
// }

let updated = format!(
"{}# generated list to test mooncakes on mooncakes.io\n{}",
parts[0], mooncakesio
);
std::fs::write("repos.txt", updated).unwrap();
// let updated = format!(
// "{}# generated list to test mooncakes on mooncakes.io\n{}",
// parts[0], mooncakesio
// );
// std::fs::write("repos.txt", updated).unwrap();
}
2 changes: 1 addition & 1 deletion src/dashboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl MoonCommand {
MoonCommand::Check(backend) => vec!["check", "-q", "--target", backend.to_flag()],
MoonCommand::Build(backend) => vec!["build", "-q", "--target", backend.to_flag()],
MoonCommand::Test(backend) => {
vec!["test", "-q", "--build-only", "--target", backend.to_flag()]
vec!["test", "-q", "--target", backend.to_flag()]
}
}
}
Expand Down
24 changes: 13 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ fn run_moon(
eprintln!(
"{}",
format!(
"moon {}, elapsed: {}ms",
"moon {}, elapsed: {}ms, {}",
args.join(" ").blue().bold(),
elapsed.as_millis()
elapsed.as_millis(),
if output.status.success() { "success" } else { "failed" }
)
.green()
.bold()
Expand Down Expand Up @@ -149,6 +150,8 @@ fn get_mooncake_sources(
// moonbitlang/core 0.1.0 0.2.0
let parts: Vec<&str> = s.split(' ').collect();
let name = parts[0].to_string();
#[cfg(target_os = "windows")]
let name = name.replace('/', "\\");
let mut xs: Vec<String> =
parts[1..].iter().copied().map(|s| s.to_string()).collect();
if xs.is_empty() {
Expand Down Expand Up @@ -435,10 +438,16 @@ fn main0() -> anyhow::Result<()> {
let res = match cli.subcommand {
cli::MoonBuildDashBoardSubcommands::Stat(cmd) => stat(cmd),
};
#[cfg(target_os = "windows")]
let os = "windows";
#[cfg(target_os = "linux")]
let os = "linux";
#[cfg(target_os = "macos")]
let os = "mac";
match res {
Ok(dashboard) => {
let date = Local::now().format("%Y-%m-%d");
let filename = format!("webapp/public/{}_data.jsonl.gz", date);
let filename = format!("webapp/public/{}/{}_data.jsonl.gz", os, date);

let fp = std::fs::OpenOptions::new()
.create(true)
Expand All @@ -451,7 +460,7 @@ fn main0() -> anyhow::Result<()> {
writer.flush()?;
writer.into_inner()?.finish()?;

let latest_filename = "webapp/public/latest_data.jsonl.gz";
let latest_filename = format!("webapp/public/{}/latest_data.jsonl.gz", os);
std::fs::copy(&filename, latest_filename)?;

Ok(())
Expand All @@ -463,10 +472,3 @@ fn main0() -> anyhow::Result<()> {
fn main() -> anyhow::Result<()> {
main0()
}

#[test]
fn test_main() {
use chrono::Local;
let date = Local::now().format("%Y-%m-%d");
println!("{}", date);
}
Loading