2022-09-21 22:01:09 +00:00
|
|
|
image: python:3.10
|
2022-09-21 21:53:45 +00:00
|
|
|
|
|
|
|
variables:
|
|
|
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
|
2022-09-21 21:58:23 +00:00
|
|
|
PIPENV_VENV_IN_PROJECT: 1
|
2022-09-21 21:53:45 +00:00
|
|
|
|
2022-09-27 17:21:03 +00:00
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- .cache/pip
|
|
|
|
- .venv/
|
|
|
|
|
2022-09-27 16:29:07 +00:00
|
|
|
stages:
|
2022-09-27 17:21:03 +00:00
|
|
|
- prepare
|
2022-09-27 16:29:07 +00:00
|
|
|
- build
|
|
|
|
- deploy
|
|
|
|
- release
|
|
|
|
|
2022-09-27 17:21:03 +00:00
|
|
|
prepare:
|
|
|
|
stage: prepare
|
|
|
|
before_script:
|
|
|
|
- pip install setuptools_scm>=6.2
|
|
|
|
script:
|
2022-09-27 18:18:39 +00:00
|
|
|
- PYTHON_VERSION=$(python --version | cut -d " " -f2)
|
2022-09-27 19:12:17 +00:00
|
|
|
- echo "PYTHON_PATH=C:\\Python310\\python.exe" | tee -a build.env
|
2022-09-27 18:18:39 +00:00
|
|
|
- echo "PYTHON_VERSION=${PYTHON_VERSION}" | tee -a build.env
|
2022-09-27 17:21:03 +00:00
|
|
|
- VERSION=$(python -m setuptools_scm)
|
|
|
|
- echo "VERSION=${VERSION}" | tee -a build.env
|
|
|
|
- echo "LINUX_AMD64_BINARY=fime_linux_amd64_${VERSION}" | tee -a build.env
|
2022-09-27 18:18:39 +00:00
|
|
|
- echo "WINDOWS_AMD64_BINARY=fime_windows_amd64_${VERSION}" | tee -a build.env
|
2022-09-27 17:21:03 +00:00
|
|
|
- echo "PACKAGE_REGISTRY_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/fime/${VERSION}" | tee -a build.env
|
|
|
|
artifacts:
|
|
|
|
reports:
|
|
|
|
dotenv: build.env
|
2022-09-21 21:53:45 +00:00
|
|
|
|
2022-09-27 16:29:07 +00:00
|
|
|
package_linux:
|
2022-09-21 21:53:45 +00:00
|
|
|
stage: build
|
2022-09-27 16:29:07 +00:00
|
|
|
before_script:
|
2022-09-21 21:53:45 +00:00
|
|
|
- python --version
|
2022-09-27 16:29:07 +00:00
|
|
|
- pip install pipenv
|
2022-09-21 21:56:18 +00:00
|
|
|
- pipenv sync --dev
|
2022-09-27 16:29:07 +00:00
|
|
|
script:
|
2022-09-27 16:34:15 +00:00
|
|
|
- pipenv run python -m build -w
|
2022-09-27 17:44:47 +00:00
|
|
|
- pipenv run pyinstaller --onefile --name "${LINUX_AMD64_BINARY}" src/fime/main.py
|
2022-09-21 21:53:45 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- dist/*.whl
|
2022-09-27 16:50:35 +00:00
|
|
|
- dist/fime_linux_*
|
|
|
|
|
2022-09-27 18:18:39 +00:00
|
|
|
package_windows:
|
|
|
|
stage: build
|
|
|
|
tags:
|
|
|
|
- shared-windows
|
|
|
|
- windows
|
|
|
|
- windows-1809
|
|
|
|
before_script:
|
2022-09-27 18:54:40 +00:00
|
|
|
- choco install python --version=$PYTHON_VERSION -y --no-progress
|
2022-09-27 19:12:17 +00:00
|
|
|
- $PYTHON_PATH --version
|
|
|
|
- $PYTHON_PATH -m pip install pipenv
|
|
|
|
- $PYTHON_PATH -m pipenv sync --dev
|
|
|
|
# for exe icon
|
|
|
|
- $PYTHON_PATH -m pipenv install pillow
|
2022-09-27 18:18:39 +00:00
|
|
|
script:
|
2022-09-27 19:12:17 +00:00
|
|
|
- $PYTHON_PATH -m pipenv run pyinstaller --onefile --windowed --name "${WINDOWS_AMD64_BINARY}" -i src/fime/icons/appointment-new.svg src/fime/main.py
|
2022-09-27 18:18:39 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- dist/fime_windows_*
|
|
|
|
|
2022-09-27 16:50:35 +00:00
|
|
|
upload:
|
|
|
|
stage: deploy
|
2022-09-27 17:21:03 +00:00
|
|
|
image: curlimages/curl:latest
|
2022-09-27 17:27:07 +00:00
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
2022-09-27 16:50:35 +00:00
|
|
|
script:
|
2022-09-27 17:21:03 +00:00
|
|
|
- |
|
|
|
|
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "dist/${LINUX_AMD64_BINARY}" "${PACKAGE_REGISTRY_URL}/${LINUX_AMD64_BINARY}"
|
2022-09-21 22:10:31 +00:00
|
|
|
|
|
|
|
release_job:
|
2022-09-27 16:29:07 +00:00
|
|
|
stage: release
|
2022-09-21 22:10:31 +00:00
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
script:
|
|
|
|
- echo "Running the release job."
|
|
|
|
release:
|
|
|
|
tag_name: $CI_COMMIT_TAG
|
|
|
|
name: 'Release $CI_COMMIT_TAG'
|
|
|
|
description: 'Release created using the release-cli.'
|
2022-09-27 17:27:07 +00:00
|
|
|
assets:
|
|
|
|
links:
|
|
|
|
- name: "${LINUX_AMD64_BINARY}"
|
|
|
|
url: "${PACKAGE_REGISTRY_URL}/${LINUX_AMD64_BINARY}"
|
2022-09-27 17:39:52 +00:00
|
|
|
filepath: "/bin/fime_linux_amd64"
|
2022-09-27 17:27:07 +00:00
|
|
|
link_type: package
|