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 - tar chjf deploy/htdocs-admin.tar.bz2 htdocs-admin
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build checker - name: build checker
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/checker-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/checker
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build evdist - name: build evdist
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/evdist-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/evdist
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build generator - name: build generator
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/generator-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/generator
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build receiver - name: build receiver
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/receiver-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/receiver
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build frontend fic ui - name: build frontend fic ui
image: node:20-alpine 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 - sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte
- npm run build - npm run build
- tar chjf ../../deploy/htdocs-frontend-fic.tar.bz2 build - tar chjf ../../deploy/htdocs-frontend-fic.tar.bz2 build
when:
branch:
exclude:
- master
- name: build dashboard - name: build dashboard
image: golang:alpine image: golang:alpine
@ -88,6 +112,10 @@ steps:
- tar chjf deploy/htdocs-dashboard.tar.bz2 htdocs-dashboard - tar chjf deploy/htdocs-dashboard.tar.bz2 htdocs-dashboard
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build repochecker - name: build repochecker
image: golang:alpine image: golang:alpine
@ -102,15 +130,10 @@ steps:
- grep "const version" repochecker/update.go | sed -r 's/^.*=\s*(\S.*)$/\1/' > deploy/repochecker.version - grep "const version" repochecker/update.go | sed -r 's/^.*=\s*(\S.*)$/\1/' > deploy/repochecker.version
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
- name: build repochecker for macOS branch:
image: golang:alpine exclude:
commands: - master
- 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
- name: build qa - name: build qa
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/qa-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/qa
environment: environment:
CGO_ENABLED: 0 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: when:
branch: branch:
exclude: exclude:
- renovate/* - master
event:
exclude:
- pull_request
- name: docker admin - name: docker admin
image: plugins/docker image: plugins/docker
@ -201,6 +205,7 @@ steps:
when: when:
branch: branch:
- master - master
- name: docker receiver - name: docker receiver
image: plugins/docker image: plugins/docker
settings: settings:
@ -306,20 +311,20 @@ steps:
branch: branch:
- master - master
#- name: docker remote-challenge-sync-airbus - name: docker remote-challenge-sync-airbus
# image: plugins/docker image: plugins/docker
# settings: settings:
# username: username:
# from_secret: docker_username from_secret: docker_username
# password: password:
# from_secret: docker_password from_secret: docker_password
# repo: nemunaire/fic-remote-challenge-sync-airbus repo: nemunaire/fic-remote-challenge-sync-airbus
# auto_tag: true auto_tag: true
# auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} auto_tag_suffix: ${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH}
# dockerfile: Dockerfile-remote-challenge-sync-airbus dockerfile: Dockerfile-remote-challenge-sync-airbus
# when: when:
# branch: branch:
# - master - master
trigger: trigger:
event: event:
@ -345,12 +350,8 @@ steps:
image: golang:alpine image: golang:alpine
commands: commands:
- apk --no-cache add git - apk --no-cache add git
- go get -v -d srs.epita.fr/fic-server/admin - go get -v -d ./...
- go get -v -d srs.epita.fr/fic-server/checker - mkdir deploy
- 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
- name: build admin - name: build admin
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/admin-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/admin
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build checker - name: build checker
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/checker-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/checker
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build evdist - name: build evdist
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/evdist-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/evdist
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build generator - name: build generator
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/generator-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/generator
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build receiver - name: build receiver
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/receiver-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/receiver
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build frontend fic ui - name: build frontend fic ui
image: node:20-alpine image: node:20-alpine
@ -395,6 +416,10 @@ steps:
- npm install --network-timeout=100000 - 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 - sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte
- npm run build - npm run build
when:
branch:
exclude:
- master
- name: build dashboard - name: build dashboard
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/dashboard-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/dashboard
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build repochecker - name: build repochecker
image: golang:alpine 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 - go build -buildvcs=false --tags checkupdate -v -o deploy/repochecker-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/repochecker
environment: environment:
CGO_ENABLED: 0 CGO_ENABLED: 0
when:
branch:
exclude:
- master
- name: build repochecker for macOS - name: build repochecker for macOS
image: golang:alpine image: golang:alpine
@ -420,6 +453,10 @@ steps:
CGO_ENABLED: 0 CGO_ENABLED: 0
GOOS: darwin GOOS: darwin
GOARCH: arm64 GOARCH: arm64
when:
branch:
exclude:
- master
- name: build qa ui - name: build qa ui
image: node:20-alpine 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 - sed -i 's!@popperjs/core/dist/esm/popper!@popperjs/core!' node_modules/sveltestrap/src/*.js node_modules/sveltestrap/src/*.svelte
- npm run build - npm run build
- tar chjf ../../deploy/htdocs-qa.tar.bz2 build - tar chjf ../../deploy/htdocs-qa.tar.bz2 build
when:
branch:
exclude:
- master
- name: build qa - name: build qa
image: golang:alpine 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 - go build -v -buildvcs=false -o deploy/qa-${DRONE_STAGE_OS}-${DRONE_STAGE_ARCH} srs.epita.fr/fic-server/qa
environment: environment:
CGO_ENABLED: 0 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: when:
branch: branch:
exclude: exclude:
- renovate/* - master
event:
exclude:
- pull_request
- name: docker admin - name: docker admin
image: plugins/docker image: plugins/docker