CI: Optimize builds

This commit is contained in:
nemunaire 2023-07-25 06:42:54 +02:00
parent c69a335a91
commit 3e5e8c9ba4

View File

@ -43,6 +43,10 @@ steps:
- tar chjf deploy/htdocs-admin.tar.bz2 htdocs-admin
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build checker
image: golang:alpine
@ -50,6 +54,10 @@ steps:
- go build -v -buildvcs=false -o deploy/checker-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/checker
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build evdist
image: golang:alpine
@ -57,6 +65,10 @@ steps:
- go build -v -buildvcs=false -o deploy/evdist-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/evdist
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build generator
image: golang:alpine
@ -64,6 +76,10 @@ steps:
- go build -v -buildvcs=false -o deploy/generator-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/generator
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build receiver
image: golang:alpine
@ -71,6 +87,10 @@ steps:
- go build -v -buildvcs=false -o deploy/receiver-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/receiver
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build frontend fic ui
image: node:20-alpine
@ -80,6 +100,10 @@ steps:
- sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte
- npm run build
- tar chjf ../../deploy/htdocs-frontend-fic.tar.bz2 build
when:
branch:
exclude:
- master
- name: build dashboard
image: golang:alpine
@ -88,6 +112,10 @@ steps:
- tar chjf deploy/htdocs-dashboard.tar.bz2 htdocs-dashboard
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build repochecker
image: golang:alpine
@ -102,15 +130,10 @@ steps:
- grep "const version" repochecker/update.go | sed -r 's/^.*=\s*(\S.*)$/\1/' > deploy/repochecker.version
environment:
CGO_ENABLED: 0
- name: build repochecker for macOS
image: golang:alpine
commands:
- go build -buildvcs=false --tags checkupdate -v -o deploy/repochecker-darwin-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/repochecker
environment:
CGO_ENABLED: 0
GOOS: darwin
GOARCH: amd64
when:
branch:
exclude:
- master
- name: build qa
image: golang:alpine
@ -118,29 +141,10 @@ steps:
- go build -v -buildvcs=false -o deploy/qa-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/qa
environment:
CGO_ENABLED: 0
- name: deploy
image: appleboy/drone-scp
failure: ignore
settings:
tar_tmp_path: /tmp/
host: srs.nemunai.re
target: /var/www/nemunai.re/srs/fic-binaries/${DRONE_BRANCH//\//-}
source: deploy/*
strip_components: 1
username:
from_secret: ssh_username
key:
from_secret: deploy_key
port:
from_secret: ssh_port
when:
branch:
exclude:
- renovate/*
event:
exclude:
- pull_request
- master
- name: docker admin
image: plugins/docker
@ -201,6 +205,7 @@ steps:
when:
branch:
- master
- name: docker receiver
image: plugins/docker
settings:
@ -306,20 +311,20 @@ steps:
branch:
- master
#- name: docker remote-challenge-sync-airbus
# image: plugins/docker
# settings:
# username:
# from_secret: docker_username
# password:
# from_secret: docker_password
# repo: nemunaire/fic-remote-challenge-sync-airbus
# auto_tag: true
# auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
# dockerfile: Dockerfile-remote-challenge-sync-airbus
# when:
# branch:
# - master
- name: docker remote-challenge-sync-airbus
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: nemunaire/fic-remote-challenge-sync-airbus
auto_tag: true
auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
dockerfile: Dockerfile-remote-challenge-sync-airbus
when:
branch:
- master
trigger:
event:
@ -345,12 +350,8 @@ steps:
image: golang:alpine
commands:
- apk --no-cache add git
- go get -v -d srs.epita.fr/fic-server/admin
- go get -v -d srs.epita.fr/fic-server/checker
- go get -v -d srs.epita.fr/fic-server/evdist
- go get -v -d srs.epita.fr/fic-server/generator
- go get -v -d srs.epita.fr/fic-server/receiver
- go get -v -d srs.epita.fr/fic-server/dashboard
- go get -v -d ./...
- mkdir deploy
- name: build admin
image: golang:alpine
@ -359,6 +360,10 @@ steps:
- go build -v -buildvcs=false -o deploy/admin-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/admin
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build checker
image: golang:alpine
@ -366,6 +371,10 @@ steps:
- go build -v -buildvcs=false -o deploy/checker-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/checker
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build evdist
image: golang:alpine
@ -373,6 +382,10 @@ steps:
- go build -v -buildvcs=false -o deploy/evdist-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/evdist
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build generator
image: golang:alpine
@ -380,6 +393,10 @@ steps:
- go build -v -buildvcs=false -o deploy/generator-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/generator
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build receiver
image: golang:alpine
@ -387,6 +404,10 @@ steps:
- go build -v -buildvcs=false -o deploy/receiver-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/receiver
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build frontend fic ui
image: node:20-alpine
@ -395,6 +416,10 @@ steps:
- npm install --network-timeout=100000
- sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte
- npm run build
when:
branch:
exclude:
- master
- name: build dashboard
image: golang:alpine
@ -402,6 +427,10 @@ steps:
- go build -v -buildvcs=false -o deploy/dashboard-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/dashboard
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build repochecker
image: golang:alpine
@ -410,6 +439,10 @@ steps:
- go build -buildvcs=false --tags checkupdate -v -o deploy/repochecker-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/repochecker
environment:
CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build repochecker for macOS
image: golang:alpine
@ -420,6 +453,10 @@ steps:
CGO_ENABLED: 0
GOOS: darwin
GOARCH: arm64
when:
branch:
exclude:
- master
- name: build qa ui
image: node:20-alpine
@ -429,6 +466,10 @@ steps:
- sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte
- npm run build
- tar chjf ../../deploy/htdocs-qa.tar.bz2 build
when:
branch:
exclude:
- master
- name: build qa
image: golang:alpine
@ -436,29 +477,10 @@ steps:
- go build -v -buildvcs=false -o deploy/qa-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/qa
environment:
CGO_ENABLED: 0
- name: deploy
image: appleboy/drone-scp:linux-arm64
failure: ignore
settings:
tar_tmp_path: /tmp/
host: srs.nemunai.re
target: /var/www/nemunai.re/srs/fic-binaries/${DRONE_BRANCH//\//-}
source: deploy/*
strip_components: 1
username:
from_secret: ssh_username
key:
from_secret: deploy_key
port:
from_secret: ssh_port
when:
branch:
exclude:
- renovate/*
event:
exclude:
- pull_request
- master
- name: docker admin
image: plugins/docker