2021-04-04 21:52:27 +03:00
|
|
|
name: VC gen
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2021-04-14 10:58:16 +03:00
|
|
|
paths-ignore:
|
|
|
|
- "**.md"
|
2021-04-04 21:52:27 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-vc:
|
2021-07-19 13:19:03 +03:00
|
|
|
runs-on: ubuntu-latest
|
2021-07-19 13:26:36 +03:00
|
|
|
env:
|
|
|
|
VREPO: github.com/vlang/vc.git
|
2021-04-04 21:52:27 +03:00
|
|
|
steps:
|
2021-07-19 13:26:36 +03:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Build V
|
|
|
|
run: make
|
|
|
|
- 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"
|
2021-04-05 18:12:07 +03:00
|
|
|
|
2021-07-19 13:26:36 +03:00
|
|
|
COMMIT_HASH=$(git rev-parse --short HEAD)
|
|
|
|
COMMIT_MSG=$(git log -1 --oneline --pretty='%s' HEAD)
|
2021-04-04 21:52:27 +03:00
|
|
|
|
2021-07-19 13:26:36 +03:00
|
|
|
rm -rf vc
|
|
|
|
git clone --depth=1 \
|
|
|
|
https://vlang-bot:${{ secrets.VLANG_BOT_SECRET }}@$VREPO
|
2021-04-04 21:52:27 +03:00
|
|
|
|
2021-07-19 13:26:36 +03:00
|
|
|
rm -rf vc/v.c vc/v_win.c
|
2021-04-04 21:52:27 +03:00
|
|
|
|
2021-07-19 13:26:36 +03:00
|
|
|
./v -o vc/v.c -os cross cmd/v
|
2022-04-14 13:44:18 +03:00
|
|
|
./v -o vc/v_win.c -os windows -cc msvc cmd/v
|
2021-04-04 21:52:27 +03:00
|
|
|
|
2021-07-19 13:26:36 +03:00
|
|
|
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
|
2021-04-04 21:52:27 +03:00
|
|
|
|
2021-07-19 13:26:36 +03:00
|
|
|
# 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 ]
|
2021-04-04 21:52:27 +03:00
|
|
|
|
2021-07-19 13:26:36 +03:00
|
|
|
git -C vc add v.c v_win.c
|
|
|
|
git -C vc commit -m "[v:master] $COMMIT_HASH - $COMMIT_MSG"
|
2021-04-04 21:52:27 +03:00
|
|
|
|
2021-07-19 13:26:36 +03:00
|
|
|
# in case there are recent commits:
|
|
|
|
git -C vc pull --rebase origin master
|
|
|
|
git -C vc push
|