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

Commit

Permalink
Merge pull request #28 from JanssenProject/package-jans-cli
Browse files Browse the repository at this point in the history
feat: package jans cli
  • Loading branch information
devrimyatar authored May 6, 2021
2 parents 3c679ce + 72affc9 commit 6e4e36b
Show file tree
Hide file tree
Showing 153 changed files with 407 additions and 221 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/releaseplease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
push:
branches:
- main
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v2
with:
token: ${{ secrets.MOWORKFLOWTOKEN }}
release-type: python

78 changes: 78 additions & 0 deletions .github/workflows/uploadrelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: upload-release
# This builds, packages and releases jans-cli
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
publish:
name: Publish for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: jans-cli.pyz
asset_name: jans-cli-linux-amd64.pyz
#- os: windows-latest
# artifact_name: jans-cli-windows
# asset_name: jans-cli-windows-amd64
- os: macos-latest
artifact_name: jans-cli.pyz
asset_name: jans-cli-macos-amd64.pyz

steps:
- name: Checkout code
uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install jq
- name: Lint with flake8
run: |
pip3 install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Checkout code
uses: actions/checkout@master

- name: Build Zipapp
run: |
sudo apt-get update || brew install jq
sudo apt-get install build-essential || echo "Maybe im on macor OS"
pip3 install shiv
make zipapp
- name: Get project
id: project
run: |
echo "::set-output name=gituser::$(python3 -c 'import os ; REPO = os.environ.get("GITHUB_REPOSITORY") ; print(str(REPO).split("/")[0])')"
echo "::set-output name=gitproject::$(python3 -c 'import os ; REPO = os.environ.get("GITHUB_REPOSITORY") ; print(str(REPO).split("/")[1])')"
- name: Get latest tag
id: previoustag
run: |
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)"
- name: Print Version
run: |
echo "${{ steps.previoustag.outputs.tag }}"
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.MOWORKFLOWTOKEN }}
file: ${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ steps.previoustag.outputs.tag }}
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.DEFAULT_GOAL := develop

develop:
/usr/bin/env python3 setup.py develop

install:
pip3 install .

uninstall:
pip3 uninstall jans-cli -y

zipapp:
shiv --compressed -o jans-cli.pyz -p '/usr/bin/env python3' -e cli:config-cli . --no-cache
43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,48 @@ Table of Contents

# _Installation_

**jans-cli** is automatically installed if you choose `jans-config-api` during installation

## Build `jans-cli.pyz` manually

## Prerequisites

1. Python 3.6+.
1. Python `pip3` package.

### Standard Python package

1. Create virtual environment and activate:

```sh
python3 -m venv .venv
source .venv/bin/activate
```

1. Install the package:

```
make install
```

This command will install executable called `jans-cli` available in virtual environment `PATH`.

### Python zipapp

1. Install [shiv](https://shiv.readthedocs.io/) using `pip3`:

```sh
pip3 install shiv
```

1. Install the package:

```sh
make zipapp
```

This command will generate executable called `jans-cli.pyz` under the same directory.

**jans-cli** is automatically installed if you choose `jans-config-api` during VM installation
of the [Janssen Server](https://github.com/JanssenProject/home).

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

0 comments on commit 6e4e36b

Please sign in to comment.