Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xenv
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Manoel Römmer
xenv
Commits
a7530abc
Commit
a7530abc
authored
3 years ago
by
Benedikt Steinbusch
Browse files
Options
Downloads
Patches
Plain Diff
update CI configuration to use public runner
parent
cdb99806
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+8
-18
8 additions, 18 deletions
.gitlab-ci.yml
tar.py
+0
-106
0 additions, 106 deletions
tar.py
with
8 additions
and
124 deletions
.gitlab-ci.yml
+
8
−
18
View file @
a7530abc
variables
:
VERSION
:
'
1.1'
python_3_lint
:
default
:
image
:
python:3
tags
:
-
public-docker
lint
:
before_script
:
-
pip install pylint
script
:
-
pylint -j 8 --disable=wrong-import-position,deprecated-lambda setup.py xenv
python_3_flake
:
image
:
python:3
flake
:
before_script
:
-
pip install flake8
script
:
-
flake8
python_3_radon
:
image
:
python:3
radon
:
before_script
:
-
pip install radon
script
:
...
...
@@ -25,15 +24,6 @@ python_3_radon:
-
radon raw .
-
radon hal .
python_3_tar
:
image
:
python:3
script
:
-
tar --warning=no-file-changed --exclude=.git* --exclude=Makefile --exclude modules.sh --exclude tar.py --exclude xenv.ini --transform "s,^\.,xenv-${VERSION}-$(date +%Y%m%d)git${CI_COMMIT_SHA:0:7}," -cvzf xenv-${VERSION}-$(date +%Y%m%d)git${CI_COMMIT_SHA:0:7}.tar.gz . || ( export ret=$?; [[ $ret -eq 1 ]] || exit "$ret" )
artifacts
:
paths
:
-
xenv-${VERSION}-$(date +%Y%m%d)git${CI_COMMIT_SHA:0:7}.tar.gz
python_3_install
:
image
:
python:3
install
:
script
:
-
python setup.py install
This diff is collapsed.
Click to expand it.
tar.py
deleted
100644 → 0
+
0
−
106
View file @
cdb99806
#!/usr/bin/env python
"""
helper script for creating a tar archive of given python module
"""
import
datetime
import
os
import
shutil
import
subprocess
import
sys
import
time
def
create_process
(
argv
):
"""
Create a process and return the handle
:param argv:
:return:
"""
process
=
subprocess
.
Popen
(
argv
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
return
process
def
wait_for_process
(
process
):
"""
Wait for termination of a process.
:param process:
:return:
"""
out
,
err
=
process
.
communicate
()
return_code
=
process
.
wait
()
return
return_code
,
out
,
err
def
_create_process_and_wait
(
argv
):
"""
Create a subprocess and wait for it to exit. Return the exit
code and standard output/exit as a triplet.
:param argv:
:return: process handle
"""
return
wait_for_process
(
create_process
(
argv
))
def
create_process_and_wait
(
argv
):
"""
Variant of createProcessAndWait which does not return the exit code but
raises an exception if the command failed.
:param argv:
:return: tuple containing process stdout/stderr
"""
code
,
out
,
err
=
_create_process_and_wait
(
argv
)
if
code
:
raise
Exception
(
'
Command
"
{}
"
failed with exit code {}.
'
.
format
(
argv
,
code
))
return
out
.
decode
(
'
utf-8
'
),
err
.
decode
(
'
utf-8
'
)
def
git_head_commit
():
"""
Get the short form of the HEAD commit of a git repostitory
:return: string
"""
return
create_process_and_wait
(
[
'
git
'
,
'
rev-parse
'
,
'
--verify
'
,
'
--short
'
,
'
HEAD
'
])[
0
].
strip
()
def
main
(
name
,
version
):
"""
Create a archive for given sources with naming scheme following the Fedora
naming guidelines:
https://fedoraproject.org/wiki/Packaging:NamingGuidelines
:param name: package name for prefixinf result archive
:param version: version string for later archive
:return:
"""
date
=
datetime
.
datetime
.
fromtimestamp
(
time
.
time
()).
strftime
(
'
%Y%m%d
'
)
commit
=
git_head_commit
()
files
=
os
.
listdir
(
'
.
'
)
archive
=
'
{}-{}-{}git{}
'
.
format
(
name
,
version
,
date
,
commit
)
os
.
mkdir
(
archive
)
for
fle
in
files
:
if
fle
in
[
'
.git
'
,
'
.gitignore
'
,
'
.idea
'
,
'
tar.py
'
,
'
Makefile
'
,
'
modules.sh
'
,
'
xenv.ini
'
'
.gitlab-ci.yml
'
]:
continue
if
os
.
path
.
isdir
(
fle
):
copy
=
shutil
.
copytree
else
:
copy
=
shutil
.
copy
copy
(
fle
,
archive
+
'
/
'
+
fle
)
create_process_and_wait
([
'
tar
'
,
'
-czf
'
,
archive
+
'
.tar.gz
'
,
archive
])
shutil
.
rmtree
(
archive
)
return
0
main
(
sys
.
argv
[
1
],
sys
.
argv
[
2
])
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