crafty-4/.gitlab-ci.yml

155 lines
4.8 KiB
YAML
Raw Normal View History

2021-09-10 21:15:47 +00:00
stages:
2021-09-23 01:59:55 +00:00
- win-dev
- win-prod
- docker-dev
- docker-prod
2021-09-10 21:15:47 +00:00
docker-build-dev:
image: docker:latest
services:
- name: docker:dind
command: ["--experimental"]
2021-09-23 01:59:55 +00:00
stage: docker-dev
2021-09-21 00:52:18 +00:00
tags:
2021-09-22 18:02:28 +00:00
- docker
2021-09-10 21:15:47 +00:00
rules:
- if: $CI_COMMIT_BRANCH == 'dev'
environment:
name: development
before_script:
2021-09-22 18:02:28 +00:00
- |
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
2021-09-10 21:15:47 +00:00
script:
- |
tag=":$CI_COMMIT_REF_SLUG"
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
- docker buildx create --use --name zedBuilder
2021-09-10 21:15:47 +00:00
- 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."
echo "Please review multi-arch manifests are present:"
2021-09-22 17:53:00 +00:00
docker buildx imagetools inspect "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
2021-09-10 21:15:47 +00:00
docker-build-prod:
image: docker:latest
services:
- name: docker:dind
command: ["--experimental"]
2021-09-23 01:59:55 +00:00
stage: docker-prod
2021-09-21 00:52:18 +00:00
tags:
2021-09-22 18:02:28 +00:00
- docker
2021-09-10 21:15:47 +00:00
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
environment:
name: production
before_script:
2021-09-22 18:02:28 +00:00
- |
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
2021-09-10 21:15:47 +00:00
script:
- |
tag=""
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
- docker buildx create --use --name zedBuilder
2021-09-10 21:15:47 +00:00
- 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."
echo "Please review multi-arch manifests are present:"
2021-09-22 17:53:00 +00:00
docker buildx imagetools inspect "$CI_REGISTRY_IMAGE${tag}"
2021-09-23 01:59:55 +00:00
win-dev-build:
stage: win-dev
tags:
- win64
cache:
paths:
- .venv/
rules:
- if: "$CI_COMMIT_BRANCH == 'dev'"
environment:
name: development
script:
- |
$ErrorActionPreference = "Stop"
2021-09-23 02:34:15 +00:00
py -m venv .venv
2021-09-23 01:59:55 +00:00
.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
2021-09-23 01:59:55 +00:00
--hidden-import cryptography
--hidden-import cffi
artifacts:
paths:
- app\
- .\crafty_commander.exe
exclude:
2021-09-24 22:17:50 +00:00
- app\classes\**\*
# Download latest:
# | https://gitlab.com/crafty-controller/crafty-commander/-/jobs/artifacts/dev/download?job=win-dev-build
2021-09-23 01:59:55 +00:00
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"
2021-09-23 02:34:15 +00:00
py -m venv .venv
2021-09-23 01:59:55 +00:00
.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
2021-09-23 01:59:55 +00:00
--hidden-import cryptography
--hidden-import cffi
artifacts:
paths:
- app\
- .\crafty_commander.exe
exclude:
2021-09-24 22:17:50 +00:00
- app\classes\**\*
# Download latest:
# | https://gitlab.com/crafty-controller/crafty-commander/-/jobs/artifacts/master/download?job=win-prod-build