Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
SteamOS Devkit Client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
devkit
SteamOS Devkit Client
Commits
8e83c1ad
Commit
8e83c1ad
authored
3 years ago
by
Timothee Besset
Browse files
Options
Downloads
Patches
Plain Diff
CI: add deploy stage
parent
e9b3a07a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+17
-0
17 additions, 0 deletions
.gitlab-ci.yml
setup/gitlab-deploy.py
+32
-0
32 additions, 0 deletions
setup/gitlab-deploy.py
setup/gitlab-linux.py
+9
-0
9 additions, 0 deletions
setup/gitlab-linux.py
setup/gitlab-windows.py
+7
-1
7 additions, 1 deletion
setup/gitlab-windows.py
with
65 additions
and
1 deletion
.gitlab-ci.yml
+
17
−
0
View file @
8e83c1ad
...
...
@@ -3,15 +3,32 @@ variables:
stages
:
-
build
-
deploy
build-linux
:
stage
:
build
tags
:
-
linux
script
:
./setup/gitlab-linux.py
artifacts
:
paths
:
-
artifacts/
build-windows
:
stage
:
build
tags
:
-
windows
script
:
./setup/gitlab-windows.py
artifacts
:
paths
:
-
artifacts/
deploy
:
stage
:
deploy
when
:
manual
needs
:
-
build-linux
-
build-windows
tags
:
-
linux
script
:
./setup/gitlab-deploy.py
This diff is collapsed.
Click to expand it.
setup/gitlab-deploy.py
0 → 100755
+
32
−
0
View file @
8e83c1ad
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import
sys
import
os
import
stat
import
subprocess
import
glob
ROOT_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
..
'
))
STEAMOS_DEVKIT_CI_UPLOAD_HOST
=
os
.
environ
.
get
(
'
STEAMOS_DEVKIT_CI_UPLOAD_HOST
'
)
STEAMOS_DEVKIT_CI_UPLOAD_PATH
=
os
.
environ
.
get
(
'
STEAMOS_DEVKIT_CI_UPLOAD_PATH
'
)
STEAMOS_DEVKIT_CI_UPLOAD_SSH_PRIVATE_KEY_FILE
=
os
.
environ
.
get
(
'
STEAMOS_DEVKIT_CI_UPLOAD_SSH_PRIVATE_KEY_FILE
'
)
STEAMOS_DEVKIT_CI_UPLOAD_USER
=
os
.
environ
.
get
(
'
STEAMOS_DEVKIT_CI_UPLOAD_USER
'
)
if
__name__
==
'
__main__
'
:
os
.
chmod
(
STEAMOS_DEVKIT_CI_UPLOAD_SSH_PRIVATE_KEY_FILE
,
stat
.
S_IREAD
)
version_tag
=
subprocess
.
check_output
([
'
git
'
,
'
describe
'
],
cwd
=
ROOT_DIR
,
universal_newlines
=
True
).
strip
()
print
(
f
'
Deploy version:
{
version_tag
}
'
)
src_dir
=
os
.
path
.
join
(
ROOT_DIR
,
'
artifacts
'
)
dst_dir
=
os
.
path
.
join
(
STEAMOS_DEVKIT_CI_UPLOAD_PATH
,
version_tag
)
latest_dir
=
os
.
path
.
join
(
STEAMOS_DEVKIT_CI_UPLOAD_PATH
,
'
latest
'
)
cmd
=
f
'
rsync -rv -e
"
ssh -o StrictHostKeyChecking=no -i
{
STEAMOS_DEVKIT_CI_UPLOAD_SSH_PRIVATE_KEY_FILE
}
"
{
src_dir
}
/
{
STEAMOS_DEVKIT_CI_UPLOAD_USER
}
@
{
STEAMOS_DEVKIT_CI_UPLOAD_HOST
}
:
{
dst_dir
}
'
print
(
cmd
)
subprocess
.
check_call
(
cmd
,
shell
=
True
)
cmd
=
f
'
ssh -o StrictHostKeyChecking=no -i
{
STEAMOS_DEVKIT_CI_UPLOAD_SSH_PRIVATE_KEY_FILE
}
{
STEAMOS_DEVKIT_CI_UPLOAD_USER
}
@
{
STEAMOS_DEVKIT_CI_UPLOAD_HOST
}
/bin/bash -c
"
cd
{
STEAMOS_DEVKIT_CI_UPLOAD_PATH
}
; rm -f latest ; ln -s
{
version_tag
}
latest
"'
print
(
cmd
)
subprocess
.
check_call
(
cmd
,
shell
=
True
)
This diff is collapsed.
Click to expand it.
setup/gitlab-linux.py
+
9
−
0
View file @
8e83c1ad
...
...
@@ -6,8 +6,10 @@ import os
import
subprocess
import
tempfile
import
shutil
import
glob
ROOT_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
..
'
))
ARTIFACTS_DIR
=
os
.
path
.
join
(
ROOT_DIR
,
'
artifacts
'
)
assert
sys
.
platform
==
'
linux
'
assert
sys
.
prefix
==
sys
.
base_prefix
# executed at build VM OS level
...
...
@@ -19,6 +21,7 @@ def call(cmd, cwd):
print
(
f
'
END CMD:
{
cmd
}
'
)
if
__name__
==
'
__main__
'
:
os
.
makedirs
(
ARTIFACTS_DIR
,
exist_ok
=
True
)
for
python_minor
in
(
9
,
10
):
build_dir
=
os
.
path
.
abspath
(
os
.
path
.
join
(
ROOT_DIR
,
f
'
../steamos-devkit-py3
{
python_minor
}
'
))
interpreter
=
f
'
python3.
{
python_minor
}
'
...
...
@@ -38,4 +41,10 @@ if __name__ == '__main__':
pipenv_cmd
=
f
'
{
interpreter
}
-m pipenv run
'
call
(
f
'
{
pipenv_cmd
}
pip install pyimgui-wheels/imgui-2.0.0-cp3
{
python_minor
}
-cp3
{
python_minor
}
-linux_x86_64.whl
'
,
build_dir
)
call
(
f
'
{
pipenv_cmd
}
{
interpreter
}
./setup/package-linux.py
'
,
build_dir
)
g
=
glob
.
glob
(
f
'
{
build_dir
}
/devkit-gui*.pyz
'
)
if
len
(
g
)
!=
1
:
raise
Exception
(
'
No .pyz build artifact produced? Aborting
'
)
artifact
=
g
[
0
]
print
(
f
'
copy
{
artifact
}
->
{
ARTIFACTS_DIR
}
'
)
shutil
.
copyfile
(
artifact
,
os
.
path
.
join
(
ARTIFACTS_DIR
,
os
.
path
.
basename
(
artifact
)))
This diff is collapsed.
Click to expand it.
setup/gitlab-windows.py
+
7
−
1
View file @
8e83c1ad
...
...
@@ -7,6 +7,7 @@ import subprocess
import
shutil
ROOT_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'
..
'
))
PACKAGE_FILE
=
'
devkit-gui-win64.zip
'
assert
sys
.
platform
==
'
win32
'
assert
sys
.
prefix
==
sys
.
base_prefix
# executed at build VM OS level
...
...
@@ -24,4 +25,9 @@ if __name__ == '__main__':
call
(
f
'
{
pip
}
install --upgrade setuptools
'
)
call
(
f
'
{
pip
}
install -r requirements.txt
'
)
call
(
rf
'
{
pip
}
install .\pyimgui-wheels\imgui-2.0.0-cp310-cp310-win_amd64.whl
'
)
call
(
rf
'
{
interpreter
}
.\setup\package-windows.py
'
)
\ No newline at end of file
call
(
rf
'
{
interpreter
}
.\setup\package-windows.py
'
)
if
not
os
.
path
.
exists
(
PACKAGE_FILE
):
raise
Exception
(
f
'
{
PACKAGE_FILE
}
not found
'
)
os
.
makedirs
(
'
artifacts
'
,
exist_ok
=
True
)
# copy to an artifacts/ file, consistent with the linux build
shutil
.
copyfile
(
PACKAGE_FILE
,
os
.
path
.
join
(
'
artifacts
'
,
PACKAGE_FILE
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment