mirror of
https://gitea.publichub.eu/oscar.krause/fastapi-dls.git
synced 2024-11-10 00:18:47 +00:00
.gitlab-ci.yml improvements
This commit is contained in:
parent
7abfb96841
commit
aa76ba5650
@ -16,9 +16,14 @@ build:docker:
|
|||||||
- docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${CI_BUILD_REF}
|
- docker push ${CI_REGISTRY}/${CI_PROJECT_PATH}/${CI_BUILD_REF_NAME}:${CI_BUILD_REF}
|
||||||
|
|
||||||
build:apt:
|
build:apt:
|
||||||
image: debian:bookworm-slim # just to get "python3-jose" working
|
image: debian:bookworm-slim
|
||||||
|
interruptible: true
|
||||||
stage: build
|
stage: build
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH
|
||||||
before_script:
|
before_script:
|
||||||
|
- echo "COMMIT=${CI_COMMIT_SHA}" >> version.env
|
||||||
|
# install build dependencies
|
||||||
- apt-get update -qq && apt-get install -qq -y build-essential
|
- apt-get update -qq && apt-get install -qq -y build-essential
|
||||||
# create build directory for .deb sources
|
# create build directory for .deb sources
|
||||||
- mkdir build
|
- mkdir build
|
||||||
@ -43,10 +48,15 @@ build:apt:
|
|||||||
|
|
||||||
build:pacman:
|
build:pacman:
|
||||||
image: archlinux:base-devel
|
image: archlinux:base-devel
|
||||||
|
interruptible: true
|
||||||
stage: build
|
stage: build
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH
|
||||||
before_script:
|
before_script:
|
||||||
|
- echo "COMMIT=${CI_COMMIT_SHA}" >> version.env
|
||||||
|
# install build dependencies
|
||||||
- pacman -Syu --noconfirm git
|
- pacman -Syu --noconfirm git
|
||||||
# "makepkg" don't likes root user
|
# create a build-user because "makepkg" don't like root user
|
||||||
- useradd --no-create-home --shell=/bin/false build && usermod -L build
|
- useradd --no-create-home --shell=/bin/false build && usermod -L build
|
||||||
- 'echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
|
- 'echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
|
||||||
- 'echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
|
- 'echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers'
|
||||||
@ -67,6 +77,9 @@ build:pacman:
|
|||||||
test:
|
test:
|
||||||
image: python:3.10-slim-bullseye
|
image: python:3.10-slim-bullseye
|
||||||
stage: test
|
stage: test
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_BRANCH
|
||||||
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
variables:
|
variables:
|
||||||
DATABASE: sqlite:///../app/db.sqlite
|
DATABASE: sqlite:///../app/db.sqlite
|
||||||
before_script:
|
before_script:
|
||||||
@ -87,13 +100,14 @@ test:
|
|||||||
variables:
|
variables:
|
||||||
DEBIAN_FRONTEND: noninteractive
|
DEBIAN_FRONTEND: noninteractive
|
||||||
before_script:
|
before_script:
|
||||||
- apt-get update -qq && apt-get install -qq -y jq
|
- apt-get update -qq && apt-get install -qq -y jq curl
|
||||||
script:
|
script:
|
||||||
# test installation
|
# test installation
|
||||||
- apt-get install -q -y ./build/build.deb --fix-missing
|
- apt-get install -q -y ./build/build.deb --fix-missing
|
||||||
# copy example config from GitLab-CI-Variables
|
# copy example config from GitLab-CI-Variables
|
||||||
#- cat ${EXAMPLE_CONFIG} > /etc/fastapi-dls/env
|
#- cat ${EXAMPLE_CONFIG} > /etc/fastapi-dls/env
|
||||||
# start service in background
|
# start service in background
|
||||||
|
- cd /usr/share/fastapi-dls/app
|
||||||
- uvicorn --host 127.0.0.1 --port 443
|
- uvicorn --host 127.0.0.1 --port 443
|
||||||
--app-dir /usr/share/fastapi-dls/app
|
--app-dir /usr/share/fastapi-dls/app
|
||||||
--ssl-keyfile /etc/fastapi-dls/webserver.key
|
--ssl-keyfile /etc/fastapi-dls/webserver.key
|
||||||
@ -118,8 +132,12 @@ test:ubuntu:
|
|||||||
|
|
||||||
test:archlinux:
|
test:archlinux:
|
||||||
image: archlinux:base
|
image: archlinux:base
|
||||||
|
needs:
|
||||||
|
- job: build:pacman
|
||||||
|
artifacts: true
|
||||||
script:
|
script:
|
||||||
- echo "Todo"
|
- pacman -Sy
|
||||||
|
- pacman -U --noconfirm fastapi-dls-*.pkg.tar.zs
|
||||||
|
|
||||||
deploy:docker:
|
deploy:docker:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
@ -152,7 +170,7 @@ deploy:apt:
|
|||||||
image: debian:bookworm-slim
|
image: debian:bookworm-slim
|
||||||
stage: deploy
|
stage: deploy
|
||||||
rules:
|
rules:
|
||||||
#- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
- changes:
|
- changes:
|
||||||
- .DEBIAN/**/*
|
- .DEBIAN/**/*
|
||||||
- app/**/*
|
- app/**/*
|
||||||
@ -194,11 +212,11 @@ deploy:apt:
|
|||||||
deploy:pacman:
|
deploy:pacman:
|
||||||
image: archlinux:base-devel
|
image: archlinux:base-devel
|
||||||
stage: deploy
|
stage: deploy
|
||||||
# rules:
|
rules:
|
||||||
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
||||||
# - changes:
|
# - changes:
|
||||||
# - .PKGBUILD/**/*
|
# - .PKGBUILD/**/*
|
||||||
# - app/**/*
|
# - app/**/*
|
||||||
needs:
|
needs:
|
||||||
- job: build:pacman
|
- job: build:pacman
|
||||||
artifacts: true
|
artifacts: true
|
||||||
|
Loading…
Reference in New Issue
Block a user