[ci] Convert to DAG and commit windows artifacts from Linux, because SSH in Windows is really stubborn

This commit is contained in:
Fabian 2022-09-30 19:33:34 +02:00
parent 845cc1ca16
commit 123ea65f2b

View File

@ -15,15 +15,7 @@ workflow:
when: never
- when: always
stages:
- prepare
- build
- deploy
- release
prepare:
stage: prepare
before_script:
- pip install setuptools_scm>=6.2
script:
@ -41,7 +33,6 @@ prepare:
dotenv: build.env
update_windows_deps:
stage: prepare
tags:
- shared-windows
- windows
@ -59,26 +50,32 @@ update_windows_deps:
- Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
- choco install python --version=$PYTHON_VERSION -y --no-progress
- refreshenv
#- ssh -V
#- choco install openssh dos2unix -y --no-progress
- ssh -V
- python --version
- pip install pipenv
- Get-Service -Name ssh-agent | Set-Service -StartupType Manual
- ssh-agent
#- dos2unix "${WINDOWS_SSH_PRIVATE_KEY}"
#- cat "${WINDOWS_SSH_PRIVATE_KEY}" | ssh-add -
script:
- pipenv lock --dev --keep-outdated
artifacts:
paths:
- Pipfile.lock
# commit from linux, because setting up SSH in Windows is a fucking nightmare
commit_windows_deps:
needs:
- update_windows_deps
image: alpine
before_script:
- apk add --update git openssh-client
- eval $(ssh-agent -s)
- echo $env:WINDOWS_SSH_PRIVATE_KEY | & ssh-add -
- git config --global user.name "Gitlab CI"
- git config --global user.email "ci@gitlab.com"
script:
- pipenv lock --dev --keep-outdated
- git commit -m "Updated windows deps from CI" Pipfile.lock
- git push
package_linux:
stage: build
needs:
- prepare
before_script:
- python --version
- pip install pipenv
@ -92,7 +89,8 @@ package_linux:
- dist/fime_linux_*
package_windows:
stage: build
needs:
- prepare
tags:
- shared-windows
- windows
@ -111,8 +109,9 @@ package_windows:
paths:
- dist/fime_windows_*
pypi_package:
stage: deploy
pypi_upload:
needs:
- package_linux
environment: pypi
rules:
- if: $CI_COMMIT_TAG
@ -121,8 +120,10 @@ pypi_package:
script:
- twine upload dist/fime-*.whl
gitlab_package:
stage: deploy
gitlab_package_upload:
needs:
- package_linux
- package_windows
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
@ -134,7 +135,8 @@ gitlab_package:
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "dist/${WINDOWS_AMD64_BINARY}.exe" "${PACKAGE_REGISTRY_URL}/${WINDOWS_AMD64_BINARY}.exe"
release_job:
stage: release
needs:
- gitlab_package_upload
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG