Skip to content

Commit d15210a

Browse files
committed
zz
1 parent e25a0c2 commit d15210a

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

docs/public/st0066-01.png

18.9 KB
Loading

docs/smalltalk/st0066.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# 使用GitHub Actions自动化构建凹语言应用
2+
3+
- 时间:2024-12-26
4+
- 撰稿:凹语言开发组
5+
- 转载请注明原文链接:[https://wa-lang.org/smalltalk/st0066.html](https://wa-lang.org/smalltalk/st0066.html)
6+
7+
---
8+
9+
GitHub Actions允许构建一个完整的 CI/CD Pipeline,与 GitHub 生态系统深度集成。这里简单展示如何使用GitHub Actions自动化构建凹语言应用。
10+
11+
首先创建一个Github仓库,并创建`heart.wa`文件:
12+
13+
```wa
14+
func main {
15+
a := 0.0
16+
for y := 1.5; y > -1.5; y = y - 0.15 {
17+
for x := -1.5; x < 1.5; x = x + 0.07 {
18+
a = x*x + y*y - 1.0
19+
if a*a*a < x*x*y*y*y {
20+
print("@")
21+
} else {
22+
print(" ")
23+
}
24+
}
25+
println()
26+
}
27+
}
28+
```
29+
30+
该程序是在命令行模式下输出一个心形图案。如果本地安装了凹语言环境,可以通过`wa run heart.wa`执行。
31+
32+
如果希望在GitHub Actions环境秩序,可以创建一个`.github/workflows/test.yml`文件:
33+
34+
```yaml
35+
name: Run Wa App
36+
on:
37+
pull_request:
38+
push:
39+
branches:
40+
- main
41+
- master
42+
- "releases/*"
43+
jobs:
44+
build-and-test-ubuntu:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Git checkout
48+
uses: actions/checkout@v2
49+
50+
- name: Set up Wa(凹语言)
51+
uses: wa-lang/setup-wa@master
52+
53+
- run: wa -v
54+
- run: wa run heart.wa
55+
```
56+
57+
然后提交全部代码并push到Github仓库,就可以看到执行的结果:
58+
59+
![](/st0066-01.png)
60+
61+
完整的代码可以参考:https://github.com/wa-lang/setup-wa
62+

0 commit comments

Comments
 (0)