mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
166 lines
5.2 KiB
YAML
166 lines
5.2 KiB
YAML
stages:
|
|
- win-dev
|
|
- win-prod
|
|
- docker-dev
|
|
- docker-prod
|
|
|
|
variables:
|
|
DOCKER_HOST: tcp://docker:2376
|
|
DOCKER_TLS_CERTDIR: "/certs"
|
|
|
|
docker-build-dev:
|
|
image: docker:latest
|
|
services:
|
|
- name: docker:dind
|
|
command: ["--experimental"]
|
|
stage: docker-dev
|
|
tags:
|
|
- docker
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == 'dev'
|
|
environment:
|
|
name: development
|
|
before_script:
|
|
- |
|
|
apk --no-cache add curl
|
|
latest_tag=$(curl -s https://api.github.com/repos/docker/buildx/releases/latest | sed -Ene '/^ *"tag_name": *"(v.+)",$/s//\1/p')
|
|
echo "Using buildx version $latest_tag"
|
|
curl -sSLo docker-buildx "https://github.com/docker/buildx/releases/download/$latest_tag/buildx-$latest_tag.linux-amd64"
|
|
chmod a+x docker-buildx
|
|
mkdir -p ~/.docker/cli-plugins
|
|
mv docker-buildx ~/.docker/cli-plugins/docker-buildx
|
|
docker version
|
|
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
- echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
|
|
script:
|
|
- |
|
|
tag=":$CI_COMMIT_REF_SLUG"
|
|
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
|
|
- docker context create tls-environment
|
|
- docker buildx create --name zedBuilder --use tls-environment
|
|
- docker buildx build
|
|
--cache-from type=registry,ref="$CI_REGISTRY_IMAGE${tag}"
|
|
--build-arg BUILDKIT_INLINE_CACHE=1
|
|
--tag "$CI_REGISTRY_IMAGE${tag}"
|
|
--platform linux/arm64/v8,linux/amd64
|
|
--push .
|
|
after_script:
|
|
- |
|
|
docker buildx rm zedBuilder && echo "Successfully Stopped builder instance" || echo "Failed to stop builder instance."
|
|
docker context rm tls-environment || true
|
|
echo "Please review multi-arch manifests are present:"
|
|
docker buildx imagetools inspect "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
|
|
|
|
docker-build-prod:
|
|
image: docker:latest
|
|
services:
|
|
- name: docker:dind
|
|
command: ["--experimental"]
|
|
stage: docker-prod
|
|
tags:
|
|
- docker
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
environment:
|
|
name: production
|
|
before_script:
|
|
- |
|
|
apk --no-cache add curl
|
|
latest_tag=$(curl -s https://api.github.com/repos/docker/buildx/releases/latest | sed -Ene '/^ *"tag_name": *"(v.+)",$/s//\1/p')
|
|
echo "Using buildx version $latest_tag"
|
|
curl -sSLo docker-buildx "https://github.com/docker/buildx/releases/download/$latest_tag/buildx-$latest_tag.linux-amd64"
|
|
chmod a+x docker-buildx
|
|
mkdir -p ~/.docker/cli-plugins
|
|
mv docker-buildx ~/.docker/cli-plugins/docker-buildx
|
|
docker version
|
|
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
|
|
- echo $CI_BUILD_TOKEN | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
|
|
script:
|
|
- |
|
|
tag=""
|
|
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
|
|
- docker context create tls-environment
|
|
- docker buildx create --name zedBuilder --use tls-environment
|
|
- docker buildx build
|
|
--cache-from type=registry,ref="$CI_REGISTRY_IMAGE${tag}"
|
|
--build-arg BUILDKIT_INLINE_CACHE=1
|
|
--tag "$CI_REGISTRY_IMAGE${tag}"
|
|
--platform linux/arm64/v8,linux/amd64
|
|
--push .
|
|
after_script:
|
|
- |
|
|
docker buildx rm zedBuilder && echo "Successfully Stopped builder instance" || echo "Failed to stop builder instance."
|
|
docker context rm tls-environment || true
|
|
echo "Please review multi-arch manifests are present:"
|
|
docker buildx imagetools inspect "$CI_REGISTRY_IMAGE${tag}"
|
|
|
|
win-dev-build:
|
|
stage: win-dev
|
|
tags:
|
|
- win64
|
|
cache:
|
|
paths:
|
|
- .venv/
|
|
rules:
|
|
- if: "$CI_COMMIT_BRANCH == 'dev'"
|
|
environment:
|
|
name: development
|
|
script:
|
|
- |
|
|
$ErrorActionPreference = "Stop"
|
|
py -m venv .venv
|
|
.venv\Scripts\activate.ps1
|
|
pip install pyinstaller
|
|
pip install -r requirements.txt
|
|
- pyinstaller -F main.py
|
|
--distpath .
|
|
--icon app\frontend\static\assets\images\Crafty_4-0_Logo_square.ico
|
|
--name "crafty_commander"
|
|
--paths .venv\Lib\site-packages
|
|
--hidden-import cryptography
|
|
--hidden-import cffi
|
|
artifacts:
|
|
name: "crafty-${CI_RUNNER_TAGS}-${CI_COMMIT_BRANCH}_${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- app\
|
|
- .\crafty_commander.exe
|
|
exclude:
|
|
- app\classes\**\*
|
|
# Download latest:
|
|
# | https://gitlab.com/crafty-controller/crafty-commander/-/jobs/artifacts/dev/download?job=win-dev-build
|
|
|
|
win-prod-build:
|
|
stage: win-prod
|
|
tags:
|
|
- win64
|
|
cache:
|
|
paths:
|
|
- .venv/
|
|
rules:
|
|
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
|
|
environment:
|
|
name: production
|
|
script:
|
|
- |
|
|
$ErrorActionPreference = "Stop"
|
|
py -m venv .venv
|
|
.venv\Scripts\activate.ps1
|
|
pip install pyinstaller
|
|
pip install -r requirements.txt
|
|
- pyinstaller -F main.py
|
|
--distpath .
|
|
--icon app\frontend\static\assets\images\Crafty_4-0_Logo_square.ico
|
|
--name "crafty_commander"
|
|
--paths .venv\Lib\site-packages
|
|
--hidden-import cryptography
|
|
--hidden-import cffi
|
|
artifacts:
|
|
name: "crafty-${CI_RUNNER_TAGS}-${CI_COMMIT_BRANCH}_${CI_COMMIT_SHORT_SHA}"
|
|
paths:
|
|
- app\
|
|
- .\crafty_commander.exe
|
|
exclude:
|
|
- app\classes\**\*
|
|
# Download latest:
|
|
# | https://gitlab.com/crafty-controller/crafty-commander/-/jobs/artifacts/master/download?job=win-prod-build
|