Skip to content

Commit 0a4fc8f

Browse files
committed
✨ Add CI and Release workflows, update README, and enhance integration tests
1 parent 7889240 commit 0a4fc8f

7 files changed

Lines changed: 133 additions & 8 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Rust
1+
name: CI
22

33
on:
44
push:

.github/workflows/release.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
name: Build (${{ matrix.os }})
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
include:
15+
- os: ubuntu-22.04
16+
target: x86_64-unknown-linux-gnu
17+
ext: ""
18+
asset_name: x86_64-unknown-linux-gnu
19+
- os: ubuntu-22.04-arm
20+
target: aarch64-unknown-linux-gnu
21+
ext: ""
22+
asset_name: aarch64-unknown-linux-gnu
23+
- os: windows-latest
24+
target: x86_64-pc-windows-msvc
25+
ext: ".exe"
26+
asset_name: x86_64-pc-windows-msvc
27+
- os: macos-13
28+
target: x86_64-apple-darwin
29+
ext: ""
30+
asset_name: x86_64-apple-darwin
31+
- os: macos-latest
32+
target: aarch64-apple-darwin
33+
ext: ""
34+
asset_name: aarch64-apple-darwin
35+
steps:
36+
- uses: actions/checkout@v4
37+
- uses: actions-rust-lang/setup-rust-toolchain@v1
38+
- name: Build
39+
run: cargo build --release --target ${{ matrix.target }}
40+
- name: Rename artifact
41+
run: |
42+
mv target/${{ matrix.target }}/release/mx${{ matrix.ext }} target/${{ matrix.target }}/release/mx-${{ matrix.asset_name}}${{ matrix.ext }}
43+
- name: Upload artifact
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: mx-${{ matrix.asset_name }}
47+
path: |
48+
target/${{ matrix.target }}/release/mx-${{ matrix.asset_name}}${{ matrix.ext }}
49+
if-no-files-found: error
50+
retention-days: 1
51+
52+
release:
53+
name: Create Release
54+
needs: build
55+
runs-on: ubuntu-latest
56+
permissions:
57+
packages: write
58+
contents: write
59+
steps:
60+
- name: Download artifacts
61+
uses: actions/download-artifact@v4
62+
with:
63+
pattern: mx*
64+
path: target
65+
- name: Generate checksums
66+
run: |
67+
cd target
68+
for file in mx*/*; do
69+
sha256sum "$file" >> checksums.txt
70+
done
71+
mkdir checksums
72+
mv checksums.txt ./checksums/checksums.txt
73+
- name: Create Release
74+
id: create_release
75+
uses: softprops/action-gh-release@v2
76+
with:
77+
files: target/*/*
78+
draft: true
79+
prerelease: false
80+
generate_release_notes: true
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
# mx - Markdown Task Runner
1+
<h1 align="center">mx</h1>
2+
3+
Markdown Task Runner
4+
5+
[![ci](https://github.com/harehare/mx/actions/workflows/ci.yml/badge.svg)](https://github.com/harehare/mx/actions/workflows/ci.yml)
26

37
`mx` is a task runner that executes code blocks in Markdown files based on section titles.
48
It is implemented using [mq](https://github.com/harehare/mq), a jq-like command-line tool for Markdown processing, to parse and extract sections from Markdown documents.
59

10+
![demo](assets/demo.gif)
11+
612
> [!WARNING]
713
> `mx` is currently under active development.
814
@@ -76,7 +82,6 @@ ruby = "ruby"
7682
node = "node"
7783
javascript = "node"
7884
js = "node"
79-
rust = "rust-script"
8085
go = "go run"
8186
php = "php"
8287
perl = "perl"
@@ -96,6 +101,8 @@ mx run --file tasks.md Build
96101

97102
## Example
98103

104+
---
105+
99106
## Bash
100107

101108
```bash
@@ -114,7 +121,7 @@ print("Hello, world!")
114121
puts "Hello, world!"
115122
```
116123

117-
## JavaScript (Node.js)
124+
## JavaScript
118125

119126
```javascript
120127
console.log("Hello, world!");

assets/demo.gif

330 KB
Loading

assets/demo.tape

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Output "demo.gif"
2+
3+
Require echo
4+
5+
Set Shell "zsh"
6+
Set FontSize 24
7+
Set Width 1200
8+
Set Height 600
9+
Set TypingSpeed 50ms
10+
Set FontFamily "Hack Nerd Font"
11+
Set Padding 16
12+
Set WindowBar Colorful
13+
Set Framerate 20
14+
15+
Hide
16+
Type "clear"
17+
Enter
18+
Show
19+
20+
Type `mx`
21+
Enter
22+
Sleep 1.5s
23+
24+
Type `mx JavaScript`
25+
Enter
26+
Sleep 1.5s
27+
28+
Type `mx Go`
29+
Enter
30+
Sleep 1.5s
31+
32+
Type `mx Python`
33+
Enter
34+
Sleep 1.5s
35+
36+
Type `mx mq`
37+
Enter
38+
Sleep 1.5s

src/config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ fn default_runtimes() -> HashMap<String, String> {
7171
runtimes.insert("node".to_string(), "node".to_string());
7272
runtimes.insert("javascript".to_string(), "node".to_string());
7373
runtimes.insert("js".to_string(), "node".to_string());
74-
runtimes.insert("rust".to_string(), "rust-script".to_string());
75-
runtimes.insert("rs".to_string(), "rust-script".to_string());
7674
runtimes.insert("go".to_string(), "go run".to_string());
7775
runtimes.insert("golang".to_string(), "go run".to_string());
7876
runtimes.insert("php".to_string(), "php".to_string());

tests/integration_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ print("world")
2828
let tasks = runner.list_tasks(&test_file).unwrap();
2929

3030
assert_eq!(tasks.len(), 2);
31-
assert_eq!(tasks[0], "Task 1");
32-
assert_eq!(tasks[1], "Task 2");
31+
assert_eq!(tasks[0], "Task 1: ");
32+
assert_eq!(tasks[1], "Task 2: ");
3333

3434
fs::remove_file(test_file).unwrap();
3535
}

0 commit comments

Comments
 (0)