2022-04-18 10:27:07 +02:00
|
|
|
platform: 'linux/amd64'
|
2022-04-18 10:28:04 +02:00
|
|
|
branches: ['master']
|
2022-04-15 09:52:10 +02:00
|
|
|
|
|
|
|
pipeline:
|
2022-04-17 17:15:39 +02:00
|
|
|
gen-vc:
|
|
|
|
# This is what the official CI uses as well
|
|
|
|
image: 'ubuntu:latest'
|
2022-04-17 17:19:03 +02:00
|
|
|
secrets:
|
|
|
|
- deploy_key
|
2022-04-17 17:15:39 +02:00
|
|
|
commands:
|
2022-04-17 17:46:16 +02:00
|
|
|
# Install necessary dependencies
|
|
|
|
- apt-get update -y && apt-get install openssh-client git build-essential -y
|
|
|
|
# Build the compiler
|
|
|
|
- make
|
2022-04-17 17:15:39 +02:00
|
|
|
# Run ssh-agent
|
|
|
|
- eval $(ssh-agent -s)
|
|
|
|
# Add ssh key
|
2022-04-17 18:01:01 +02:00
|
|
|
- echo "$DEPLOY_KEY" | tr -d '\r' | ssh-add -
|
2022-04-17 17:15:39 +02:00
|
|
|
# Create ssh dir with proper permissions
|
|
|
|
- mkdir -p ~/.ssh
|
|
|
|
- chmod 700 ~/.ssh
|
|
|
|
# Configure git credentials
|
2022-04-17 17:19:03 +02:00
|
|
|
- git config --global user.email 'vbot@rustybever.be'
|
|
|
|
- git config --global user.name 'vbot'
|
2022-04-17 18:05:06 +02:00
|
|
|
# Verify SSH keys
|
|
|
|
- ssh-keyscan git.rustybever.be > ~/.ssh/known_hosts
|
2022-04-17 17:15:39 +02:00
|
|
|
|
|
|
|
# The following is copied over from the official repo's CI
|
|
|
|
# https://github.com/vlang/v/blob/master/.github/workflows/gen_vc.yml
|
2022-04-17 17:35:30 +02:00
|
|
|
- export "COMMIT_HASH=$(git rev-parse --short HEAD)"
|
|
|
|
- export "COMMIT_MSG=$(git log -1 --oneline --pretty='%s' HEAD)"
|
2022-04-17 17:15:39 +02:00
|
|
|
- rm -rf vc
|
2022-05-05 10:58:44 +02:00
|
|
|
- git clone --depth=1 'git@git.rustybever.be:vieter/vc.git'
|
2022-04-17 17:15:39 +02:00
|
|
|
- rm -rf vc/v.c vc/v_win.c
|
|
|
|
- ./v -o vc/v.c -os cross cmd/v
|
|
|
|
- ./v -o vc/v_win.c -os windows -cc msvc cmd/v
|
2022-04-17 17:26:12 +02: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
|
2022-04-17 17:15:39 +02:00
|
|
|
# ensure the C files are over 5000 lines long, as a safety measure
|
2022-04-17 17:26:12 +02:00
|
|
|
- '[ $(wc -l < vc/v.c) -gt 5000 ]'
|
|
|
|
- '[ $(wc -l < vc/v_win.c) -gt 5000 ]'
|
2022-04-17 17:15:39 +02:00
|
|
|
- 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:
|
2022-04-17 17:43:54 +02:00
|
|
|
- git -C vc pull --rebase origin main
|
2022-04-17 17:15:39 +02:00
|
|
|
- git -C vc push
|
|
|
|
when:
|
|
|
|
event: push
|