From 1beedc54f43ff4cc3d10c3c2444974475c939f14 Mon Sep 17 00:00:00 2001 From: Jef Roosens Date: Sun, 17 Apr 2022 17:15:39 +0200 Subject: [PATCH] Fixed dockerfile; hopefully implemented vc ci routine --- .woodpecker.yml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile.builder | 2 +- Makefile | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index 7ff2a4031b..9a4e2f44a8 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -3,6 +3,52 @@ platform: linux/amd64 branch: master pipeline: + build: + image: 'ubuntu:latest' + commands: + - make + when: + event: push + + gen-vc: + # This is what the official CI uses as well + image: 'ubuntu:latest' + commands: + # Install ssh-agent if not present + - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )' + # Run ssh-agent + - eval $(ssh-agent -s) + # Add ssh key + - echo "$DEPLOY_KEY" | tr -d '\r' | ssh-add - + # Create ssh dir with proper permissions + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + # Configure git credentials + - "git config --global user.email 'vbot@rustybever.be'" + - 'git config --global user.name "vbot"' + + # The following is copied over from the official repo's CI + # https://github.com/vlang/v/blob/master/.github/workflows/gen_vc.yml + - export COMMIT_HASH=$(git rev-parse --short HEAD) + - export COMMIT_MSG=$(git log -1 --oneline --pretty='%s' HEAD) + - rm -rf vc + - git clone --depth=1 https://git.rustybever.be/Chewing_Bever/vc + - 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 + - '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' + # 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: + - git -C vc pull --rebase origin master + - git -C vc push + when: + event: push + publish: image: woodpeckerci/plugin-docker-buildx secrets: [ docker_username, docker_password ] diff --git a/Dockerfile.builder b/Dockerfile.builder index 52e1ab33d9..b6cbc043ac 100644 --- a/Dockerfile.builder +++ b/Dockerfile.builder @@ -21,7 +21,7 @@ RUN ln -s /opt/vlang/v /usr/bin/v && \ gc-dev \ diffutils -RUN git clone -b patches https://git.rustybever.be/Chewing_Bever/vieter-v /opt/vlang && \ +RUN git clone https://git.rustybever.be/Chewing_Bever/v /opt/vlang && \ make && \ v -version diff --git a/Makefile b/Makefile index f591f3b749..7c05d391d8 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ LDFLAGS ?= all: rm -rf vc/ - git clone --depth 1 --quiet https://github.com/vlang/vc + git clone --depth 1 --quiet https://git.rustybever.be/Chewing_Bever/vc $(CC) $(CFLAGS) -std=gnu11 -w -I ./thirdparty/stdatomic/nix -o v1 vc/v.c -lm -lexecinfo -lpthread $(LDFLAGS) ./v1 -no-parallel -o v2 $(VFLAGS) cmd/v ./v2 -o v $(VFLAGS) cmd/v