-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
74 lines (61 loc) · 2.33 KB
/
gen_vc_ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: VC gen
on:
workflow_dispatch:
pull_request:
paths-ignore:
- '**.vv'
- '**.out'
- '**.md'
- '**.yml'
- '!**/gen_vc_ci.yml'
- 'cmd/tools/**'
- '!cmd/tools/builders/**.v'
push:
paths-ignore:
- '**.vv'
- '**.out'
- '**.md'
- '**.yml'
- '!**/gen_vc_ci.yml'
- 'cmd/tools/**'
- '!cmd/tools/builders/**.v'
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ !contains(github.ref, 'master')}}
jobs:
build-vc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build V
run: make -j4
- name: Regenerate v.c and v_win.c
run: |
git config --global user.email "vlang-bot@users.noreply.github.com"
git config --global user.name "vlang-bot"
COMMIT_HASH=$(git rev-parse --short HEAD)
COMMIT_MSG=$(git log -1 --oneline --pretty='%s' HEAD)
rm -rf vc
./v retry -- git clone --depth=1 \
https://vlang-bot:${{ secrets.VLANG_BOT_SECRET }}@github.com/vlang/vc.git
rm -rf vc/v.c vc/v_win.c
./v -o vc/v.c -cross cmd/v
./v -o vc/v_win.c -os windows -cc msvc cmd/v
sed -i "1s/^/#define V_COMMIT_HASH \"$COMMIT_HASH\"\n/" vc/v.c
sed -i "1s/^/#define V_COMMIT_HASH \"$COMMIT_HASH\"\n/" vc/v_win.c
# do some sanity checks for the generated v.c file:
grep 'Turned ON custom defines: no_backtrace,cross' vc/v.c
grep '#define CUSTOM_DEFINE_cross' vc/v.c
# ensure the C files are over 5000 lines long, as a safety measure
[ $(wc -l < vc/v.c) -gt 5000 ]
[ $(wc -l < vc/v_win.c) -gt 5000 ]
git -C vc add v.c v_win.c
git -C vc commit -m "[v:master] $COMMIT_HASH - $COMMIT_MSG"
# in case there are recent commits:
./v retry -- git -C vc pull --rebase origin master
git -C vc log -3
- name: Deploy
if: github.event_name == 'push' && github.repository == 'vlang/v' && github.ref == 'refs/heads/master'
run: git -C vc push || true