Skip to content
This repository was archived by the owner on Jan 15, 2022. It is now read-only.

Commit 6e4e36b

Browse files
authored
Merge pull request #28 from JanssenProject/package-jans-cli
feat: package jans cli
2 parents 3c679ce + 72affc9 commit 6e4e36b

153 files changed

Lines changed: 407 additions & 221 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
name: release-please
6+
jobs:
7+
release-please:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: GoogleCloudPlatform/release-please-action@v2
11+
with:
12+
token: ${{ secrets.MOWORKFLOWTOKEN }}
13+
release-type: python
14+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: upload-release
2+
# This builds, packages and releases jans-cli
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
workflow_dispatch:
8+
jobs:
9+
publish:
10+
name: Publish for ${{ matrix.os }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
include:
15+
- os: ubuntu-latest
16+
artifact_name: jans-cli.pyz
17+
asset_name: jans-cli-linux-amd64.pyz
18+
#- os: windows-latest
19+
# artifact_name: jans-cli-windows
20+
# asset_name: jans-cli-windows-amd64
21+
- os: macos-latest
22+
artifact_name: jans-cli.pyz
23+
asset_name: jans-cli-macos-amd64.pyz
24+
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@master
28+
- name: Set up Python 3.7
29+
uses: actions/setup-python@v1
30+
with:
31+
python-version: 3.7
32+
33+
- name: Install dependencies
34+
run: |
35+
python3 -m pip install --upgrade pip
36+
pip3 install jq
37+
38+
- name: Lint with flake8
39+
run: |
40+
pip3 install flake8
41+
# stop the build if there are Python syntax errors or undefined names
42+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
43+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
44+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
45+
46+
- name: Checkout code
47+
uses: actions/checkout@master
48+
49+
- name: Build Zipapp
50+
run: |
51+
sudo apt-get update || brew install jq
52+
sudo apt-get install build-essential || echo "Maybe im on macor OS"
53+
pip3 install shiv
54+
make zipapp
55+
56+
- name: Get project
57+
id: project
58+
run: |
59+
echo "::set-output name=gituser::$(python3 -c 'import os ; REPO = os.environ.get("GITHUB_REPOSITORY") ; print(str(REPO).split("/")[0])')"
60+
echo "::set-output name=gitproject::$(python3 -c 'import os ; REPO = os.environ.get("GITHUB_REPOSITORY") ; print(str(REPO).split("/")[1])')"
61+
62+
- name: Get latest tag
63+
id: previoustag
64+
run: |
65+
echo "::set-output name=tag::$(curl https://api.github.com/repos/${{ steps.project.outputs.gituser }}/${{ steps.project.outputs.gitproject }}/releases/latest -s | grep "tag_name" | cut -d '"' -f 4)"
66+
67+
- name: Print Version
68+
run: |
69+
echo "${{ steps.previoustag.outputs.tag }}"
70+
71+
72+
- name: Upload binaries to release
73+
uses: svenstaro/upload-release-action@v2
74+
with:
75+
repo_token: ${{ secrets.MOWORKFLOWTOKEN }}
76+
file: ${{ matrix.artifact_name }}
77+
asset_name: ${{ matrix.asset_name }}
78+
tag: ${{ steps.previoustag.outputs.tag }}

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.DEFAULT_GOAL := develop
2+
3+
develop:
4+
/usr/bin/env python3 setup.py develop
5+
6+
install:
7+
pip3 install .
8+
9+
uninstall:
10+
pip3 uninstall jans-cli -y
11+
12+
zipapp:
13+
shiv --compressed -o jans-cli.pyz -p '/usr/bin/env python3' -e cli:config-cli . --no-cache

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,48 @@ Table of Contents
1212

1313
# _Installation_
1414

15-
**jans-cli** is automatically installed if you choose `jans-config-api` during installation
15+
16+
## Build `jans-cli.pyz` manually
17+
18+
## Prerequisites
19+
20+
1. Python 3.6+.
21+
1. Python `pip3` package.
22+
23+
### Standard Python package
24+
25+
1. Create virtual environment and activate:
26+
27+
```sh
28+
python3 -m venv .venv
29+
source .venv/bin/activate
30+
```
31+
32+
1. Install the package:
33+
34+
```
35+
make install
36+
```
37+
38+
This command will install executable called `jans-cli` available in virtual environment `PATH`.
39+
40+
### Python zipapp
41+
42+
1. Install [shiv](https://shiv.readthedocs.io/) using `pip3`:
43+
44+
```sh
45+
pip3 install shiv
46+
```
47+
48+
1. Install the package:
49+
50+
```sh
51+
make zipapp
52+
```
53+
54+
This command will generate executable called `jans-cli.pyz` under the same directory.
55+
56+
**jans-cli** is automatically installed if you choose `jans-config-api` during VM installation
1657
of the [Janssen Server](https://github.com/JanssenProject/home).
1758

1859
![](docs/img/jans-config-api.png)
File renamed without changes.

0 commit comments

Comments
 (0)