Stop using gradlew in gitlab-ci, collapse proto codegen into a single job, add pipeline cacheing

These changes all make the pipeline run much faster for incremental builds.
This commit is contained in:
Michael Pivato
2020-11-22 05:52:53 +00:00
parent 775a0149d3
commit 2d93438eb8
4 changed files with 42 additions and 43 deletions

View File

@@ -3,51 +3,40 @@ stages:
- build
- deploy
protoc_base:
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- "**/Package.resolved"
- "**/.build/"
- .gradle/
protoc_gen:
image: vato.ddns.net:8083/gradle
stage: protoc
rules:
- changes:
- protobuf/*
script:
- ./gradlew :protobuf:generateProto
protoc_python:
extends: protoc_base
rules:
- changes:
- pycar/*
- protobuf/*
- protobuf/*
artifacts:
paths:
- "./**/*pb2*"
- "./SwiftyCar/Sources/**/*.pb.swift"
- "./SwiftyCar/Sources/**/*.grpc.swift"
- "./CarControlleriOS/Sources/**/*.pb.swift"
- "./CarControlleriOS/Sources/**/*.grpc.swift"
expire_in: 30 days
script:
- ./gradlew :pycar:copyPythonCode
protoc_swift_Car:
extends: protoc_base
rules:
- changes:
- SwiftyCar/*
- protobuf/*
script:
- ./gradlew :SwiftyCar:copySwiftCode
protoc_swift_CarController:
extends: protoc_base
rules:
- changes:
- CarControlleriOS/*
- protobuf/*
script:
- ./gradlew :CarControlleriOS:copySwiftCode
- gradle :pycar:copyPythonCode
- gradle :SwiftyCar:copySwiftCode
- gradle :CarControlleriOS:copySwiftCode
build_pycar:
image: vato.ddns.net:8083/python-infra:buster
stage: build
rules:
- changes:
- pycar/*
- protobuf/*
needs:
- protoc_python
- pycar/*
needs:
- protoc_gen
script:
- cd pycar && python setup.py bdist_wheel && cd ..
@@ -56,20 +45,31 @@ build_pycar_docker:
stage: build
rules:
- changes:
- pycar/*
- protobuf/*
- pycar/*
needs:
- protoc_python
- protoc_gen
script:
- echo ${DOCKER_PASSWORD} | docker login vato.ddns.net:8083 --username ${DOCKER_USERNAME} --password-stdin
- docker build -f pycar/Dockerfile --build-arg PYPI_USERNAME=${PYPI_USERNAME} --build-arg PYPI_PASSWORD=${PYPI_PASSWORD} -t vato.ddns.net:8082/pycar:latest pycar
built_swift_car:
image: vato.ddns.net:8083/swift
stage: build
rules:
- changes:
- SwiftyCar/*
- protobuf/*
needs:
- protoc_gen
script:
- cd SwiftyCar && swift build
build_esp32:
image: vato.ddns.net:8083/shaguarger/platformio
stage: build
rules:
- changes:
- esp32/*
- esp32/*
script:
- platformio ci --project-conf esp32/platformio.ini esp32