-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98938fe
commit 1ffa6ad
Showing
11 changed files
with
149 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
/.infrastructure/*.Dockerfile | ||
/.venv | ||
*.pyc | ||
.coveragerc | ||
/example | ||
/docs | ||
/tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Test and release a package | ||
on: [push] | ||
|
||
jobs: | ||
build: | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: pip install -r ./requirements.txt | ||
|
||
- name: Install project via setuptools | ||
run: "rkd :install" | ||
|
||
- name: Run unit tests | ||
run: "rkd :test:unit" | ||
|
||
- name: Run functional tests | ||
run: "rkd :test:functional" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,7 @@ | |
/.idea | ||
*.pyc | ||
/.coverage | ||
.rkd/logs | ||
*__pycache__* | ||
/.venv | ||
.venv-setup.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
version: org.riotkit.rkd/yaml/v1 | ||
imports: | ||
- rkd_python | ||
|
||
environment: | ||
REPO: "quay.io/riotkit/infracheck" | ||
|
||
tasks: | ||
:test:unit: | ||
description: Run unit tests | ||
steps: | ||
- "%RKD% :py:unittest --src-dir=./ --tests-dir=tests --pattern='unit_test_*.py'" | ||
|
||
:test:functional: | ||
description: Run unit tests | ||
steps: | ||
- "python -m unittest discover -s . -p 'functional_test*.py'" | ||
- "cd infracheck && ./functional-test.sh" | ||
|
||
:install: | ||
description: Install via setuptools | ||
steps: | ||
- python3 ./setup.py install | ||
|
||
:image: | ||
description: Build a docker image | ||
arguments: | ||
"--git-tag": | ||
help: "Will tag the image considering this version" | ||
required: False | ||
"--push": | ||
help: "Push or only build?" | ||
action: store_true | ||
"--arch": | ||
help: "Architecture name" | ||
default: "x86_64" | ||
steps: | | ||
#!python | ||
tag = ctx.get_arg('--git-tag') | ||
should_push = ctx.get_arg('--push') | ||
arch = ctx.get_arg('--arch') | ||
docker_tag = 'latest-dev-' + arch | ||
repo = os.getenv('REPO') | ||
if tag: | ||
docker_tag = arch + '-' + tag | ||
image_name = '{repo}:{tag}'.format(tag=docker_tag, repo=repo) | ||
this.sh('docker build . -f ./.infrastructure/{docker_arch}.Dockerfile -t {image}' | ||
.format(docker_arch=arch, image=image_name)) | ||
this.sh('docker tag {image} {image}-$(date "+%Y-%m-%d")'.format(image=image_name)) | ||
if should_push: | ||
this.sh('docker push {image}'.format(image=image_name)) | ||
this.sh('docker push {image}-$(date "+%Y-%m-%d")'.format(image=image_name)) | ||
:release:pypi: | ||
description: Release to PyPI | ||
steps: | ||
- "%RKD% :py:build" | ||
- "%RKD% :py:publish --password=${PYPI_PASSWORD} --username=__token__ --skip-existing" | ||
|
||
:release:docker:x86: | ||
description: Release into docker registry (x86 image) | ||
arguments: | ||
"--git-tag": | ||
help: "Git tag name" | ||
required: true | ||
steps: | ||
- "%RKD% :image --push --git-tag=${ARG_GIT_TAG} --arch=x86_64" | ||
|
||
:release:docker:arm: | ||
description: Release into docker registry (arm image) | ||
arguments: | ||
"--git-tag": | ||
help: "Git tag name" | ||
required: true | ||
steps: | ||
- "%RKD% :image --push --git-tag=${ARG_GIT_TAG} --arch=arm" |
Oops, something went wrong.