Skip to content

Commit d5afab9

Browse files
author
Francesco Faraone
committed
Bump reports core
Windows installer Remove other os's bundles
1 parent 80fdc65 commit d5afab9

20 files changed

+700
-1196
lines changed

.github/workflows/build.yml

+30-24
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
branches: [ master ]
1010

1111
jobs:
12-
build:
12+
test:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
@@ -34,26 +34,32 @@ jobs:
3434
- name: Testing
3535
run: |
3636
poetry run pytest -v
37-
- name: Upload coverage
38-
uses: codecov/codecov-action@v1
39-
with:
40-
file: ./coverage.xml
41-
fail_ci_if_error: true
42-
verbose: true
43-
- name: Fix coverage.xml for Sonar
44-
run: |
45-
sed -i 's/\/home\/runner\/work\/connect-cli\/connect-cli\//\/github\/workspace\//g' coverage.xml
46-
- name: SonarCloud
47-
uses: SonarSource/sonarcloud-github-action@master
48-
env:
49-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
51-
- name: Wait sonar to process report
52-
uses: jakejarvis/wait-action@master
53-
with:
54-
time: '60s'
55-
- name: SonarQube Quality Gate check
56-
uses: sonarsource/sonarqube-quality-gate-action@master
57-
timeout-minutes: 5
58-
env:
59-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
37+
sonar:
38+
needs: [test]
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
with:
43+
fetch-depth: 0
44+
- name: Set up Python 3.10.0
45+
uses: actions/setup-python@v2
46+
with:
47+
python-version: '3.10.0'
48+
- name: Install dependencies
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install poetry
52+
poetry install
53+
- name: Generate coverage report
54+
run: |
55+
poetry run pytest
56+
- name: SonarCloud
57+
uses: SonarSource/sonarcloud-github-action@master
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
61+
- name: SonarQube Quality Gate check
62+
uses: sonarsource/sonarqube-quality-gate-action@master
63+
timeout-minutes: 5
64+
env:
65+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

.github/workflows/publish.yml

+15-105
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,6 @@ jobs:
6666
tags: cloudblueconnect/connect-cli:${{ steps.tag.outputs.result }},cloudblueconnect/connect-cli:latest
6767
- name: Docker image digest
6868
run: echo ${{ steps.docker_build.outputs.digest }}
69-
- name: Build linux distro
70-
env:
71-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72-
run: |
73-
echo version = '${{ steps.tag.outputs.result }}' > connect/.data/version.txt
74-
poetry run pyinstaller resources/ccli.spec
75-
- name: Package linux distro
76-
env:
77-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78-
run: |
79-
tar cvfz connect-cli_${{ steps.tag.outputs.result }}_linux_amd64.tar.gz dist
80-
- name: Upload distro package to artifacts
81-
uses: actions/upload-artifact@v2
82-
with:
83-
name: linux_distro
84-
path: connect-cli_${{ steps.tag.outputs.result }}_linux_amd64.tar.gz
85-
retention-days: 5
8669
windows:
8770
runs-on: windows-latest
8871
steps:
@@ -98,7 +81,7 @@ jobs:
9881
- name: Install dependencies
9982
run: |
10083
python -m pip install --upgrade pip
101-
pip install poetry
84+
pip install poetry pynsist wheel
10285
poetry install
10386
- name: Checkout latest reports repository
10487
run: |
@@ -111,81 +94,36 @@ jobs:
11194
result-encoding: string
11295
script: |
11396
return context.payload.ref.replace(/refs\/tags\//, '')
114-
- name: Build windows distro
115-
env:
116-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
- name: Generate connect-cli wheel
11798
run: |
118-
echo version = '${{ steps.tag.outputs.result }}' > connect/.data/version.txt
119-
poetry run pyinstaller resources/ccli.spec
99+
poetry version ${{ steps.tag.outputs.result }}
100+
poetry build
101+
cp dist/*.whl resources/.
102+
- name: Generate pynsist config file
103+
run: |
104+
poetry export --format requirements.txt --without-hashes --output resources/requirements.txt
105+
poetry run python resources/generate_pynsist_config.py
106+
cat resources/ccli.cfg
107+
- name: Build windows installer
108+
run: |
109+
pynsist resources/ccli.cfg
120110
- name: Package windows distro
121111
env:
122112
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123113
OS_NAME: windows
124114
CPU_ARCH: amd64
125115
PKG_TAG: ${{ steps.tag.outputs.result }}
126116
run: |
127-
& { compress-archive -path '.\dist' -destinationpath '.\connect-cli_${{ steps.tag.outputs.result }}_windows_amd64.zip' }
117+
& { compress-archive -path '.\resources\build\nsis\connect-cli_${{ steps.tag.outputs.result }}_setup.exe' -destinationpath '.\connect-cli_${{ steps.tag.outputs.result }}_windows_amd64.zip' }
128118
- name: Upload distro package to artifacts
129119
uses: actions/upload-artifact@v2
130120
with:
131121
name: windows_distro
132122
path: connect-cli_${{ steps.tag.outputs.result }}_windows_amd64.zip
133123
retention-days: 5
134-
osx:
135-
runs-on: macos-latest
136-
steps:
137-
- name: Checkout code
138-
uses: actions/checkout@v2
139-
with:
140-
fetch-depth: 0
141-
submodules: true
142-
- name: Set up Python 3.8
143-
uses: actions/setup-python@v2
144-
with:
145-
python-version: 3.8
146-
- name: Install dependencies
147-
run: |
148-
brew install cairo pango gdk-pixbuf libffi git
149-
python -m pip install --upgrade pip
150-
pip install poetry
151-
poetry install
152-
- name: Linting
153-
run: |
154-
poetry run flake8
155-
- name: Testing
156-
run: |
157-
poetry run pytest
158-
- name: Checkout latest reports repository
159-
run: |
160-
poetry run python resources/get_latest_reports.py
161-
- name: Extract tag name
162-
uses: actions/github-script@v3
163-
id: tag
164-
with:
165-
github-token: ${{ secrets.GITHUB_TOKEN }}
166-
result-encoding: string
167-
script: |
168-
return context.payload.ref.replace(/refs\/tags\//, '')
169-
- name: Build osx distro
170-
env:
171-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172-
run: |
173-
echo version = '${{ steps.tag.outputs.result }}' > connect/.data/version.txt
174-
poetry run pyinstaller resources/ccli.spec
175-
- name: Package osx distro
176-
env:
177-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
178-
run: |
179-
tar cvfz connect-cli_${{ steps.tag.outputs.result }}_osx_amd64.tar.gz dist
180-
- name: Upload distro package to artifacts
181-
uses: actions/upload-artifact@v2
182-
with:
183-
name: osx_distro
184-
path: connect-cli_${{ steps.tag.outputs.result }}_osx_amd64.tar.gz
185-
retention-days: 5
186124
release:
187125
runs-on: ubuntu-latest
188-
needs: [linux, windows, osx]
126+
needs: [linux, windows]
189127
steps:
190128
- name: Checkout code
191129
uses: actions/checkout@v2
@@ -210,20 +148,6 @@ jobs:
210148
release_name: Release ${{ steps.tag.outputs.result }}
211149
draft: false
212150
prerelease: false
213-
- name: Download linux artifact
214-
uses: actions/download-artifact@v2
215-
with:
216-
name: linux_distro
217-
path: ./
218-
- name: Attach linux distro to release
219-
uses: actions/upload-release-asset@v1
220-
env:
221-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
222-
with:
223-
upload_url: ${{ steps.create_release.outputs.upload_url }}
224-
asset_path: ./connect-cli_${{ steps.tag.outputs.result }}_linux_amd64.tar.gz
225-
asset_name: connect-cli_${{ steps.tag.outputs.result }}_linux_amd64.tar.gz
226-
asset_content_type: application/tar+gzip
227151
- name: Download windows artifact
228152
uses: actions/download-artifact@v2
229153
with:
@@ -238,17 +162,3 @@ jobs:
238162
asset_path: ./connect-cli_${{ steps.tag.outputs.result }}_windows_amd64.zip
239163
asset_name: connect-cli_${{ steps.tag.outputs.result }}_windows_amd64.zip
240164
asset_content_type: application/zip
241-
- name: Download osx artifact
242-
uses: actions/download-artifact@v2
243-
with:
244-
name: osx_distro
245-
path: ./
246-
- name: Attach osx distro to release
247-
uses: actions/upload-release-asset@v1
248-
env:
249-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
250-
with:
251-
upload_url: ${{ steps.create_release.outputs.upload_url }}
252-
asset_path: ./connect-cli_${{ steps.tag.outputs.result }}_osx_amd64.tar.gz
253-
asset_name: connect-cli_${{ steps.tag.outputs.result }}_osx_amd64.tar.gz
254-
asset_content_type: application/tar+gzip

README.md

+6-31
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Since it is extensible, users can write their own plugins to extend its function
1313

1414
### Prerequisites
1515

16-
`connect-cli` depends on [Cairo](https://www.cairographics.org/), [Pango](https://pango.gnome.org/) and
17-
[GDK-PixBuf](https://developer.gnome.org/gdk-pixbuf/stable/).
16+
`connect-cli` depends on [Git](https://git-scm.com/), [Cairo](https://www.cairographics.org/),
17+
[Pango](https://pango.gnome.org/) and [GDK-PixBuf](https://developer.gnome.org/gdk-pixbuf/stable/).
1818

1919
Please refers to the platform-specific instructions on how to install these dependecies:
2020

@@ -42,7 +42,7 @@ To use the Docker image of `connect-cli`:
4242
Please refer to the [`connect-cli` docker image documentation](https://hub.docker.com/r/cloudblueconnect/connect-cli) for more information.
4343

4444

45-
### Using Homebrew (Mac OS X only)
45+
### Using Homebrew on Mac OS X
4646

4747
To install `connect-cli` with homebrew run:
4848

@@ -52,36 +52,11 @@ To install `connect-cli` with homebrew run:
5252
$ brew install cloudblue/connect/connect-cli
5353
```
5454

55+
### Using the installer on Windows
5556

57+
An installer package is available for Windows 10 or newer.
58+
You can download its zip file from the [Github Releases](https://github.com/cloudblue/connect-cli/releases) page.
5659

57-
### Binary distributions
58-
59-
A single executable binary distribution is available for windows, linux and mac os x.
60-
You can it from the [Github Releases](https://github.com/cloudblue/connect-cli/releases) page.
61-
62-
To install under linux:
63-
64-
```
65-
$ curl -O -J https://github.com/cloudblue/connect-cli/releases/download/xx.yy/connect-cli_xx.yy_linux_amd64.tar.gz
66-
$ tar xvfz connect-cli_xx.yy_linux_amd64.tar.gz
67-
$ sudo cp dist/ccli /usr/local/bin/ccli
68-
```
69-
70-
To install under Mac OS X:
71-
72-
```
73-
$ curl -O -J https://github.com/cloudblue/connect-cli/releases/download/xx.yy/connect-cli_xx.yy_osx_amd64.tar.gz
74-
$ tar xvfz connect-cli_xx.yy_osx_amd64.tar.gz
75-
$ sudo cp dist/ccli /usr/local/bin/ccli
76-
```
77-
78-
> If your user is not a sudoer, you can copy the `ccli` executable from the dist directory to a directory of your choice
79-
> that is listed in the `PATH` variable.
80-
81-
82-
To install under Windows
83-
84-
Download the windows single executable zipfile from [Github Releases](https://github.com/cloudblue/connect-cli/releases/download/xx.yy/connect-cli_xx.yy_windows_amd64.zip), extract it and place it in a folder that is included in your `PATH` system variable.
8560

8661

8762
## Usage

connect/cli/__init__.py

+1-12
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,11 @@
22

33
# This file is part of the Ingram Micro Cloud Blue Connect connect-cli
44
# Copyright (c) 2019-2021 Ingram Micro. All Rights Reserved.
5-
import os
6-
import re
7-
85
from pkg_resources import DistributionNotFound, get_distribution
96

107

11-
MODULE_REGEX = r'[0-9]+.[0-9]'
12-
13-
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
14-
VERSION_FILE = os.path.join(BASE_DIR, os.path.join('.data', 'version.txt'))
15-
168
try:
17-
if os.path.exists(VERSION_FILE):
18-
__version__ = re.search(MODULE_REGEX, open(VERSION_FILE, 'r').read()).group()
19-
else:
20-
__version__ = get_distribution('connect-cli').version
9+
__version__ = get_distribution('connect-cli').version
2110
except DistributionNotFound: # pragma: no cover
2211
__version__ = '0.0.0'
2312

connect/cli/core/utils.py

-6
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
# This file is part of the Ingram Micro Cloud Blue Connect connect-cli.
44
# Copyright (c) 2019-2021 Ingram Micro. All Rights Reserved.
5-
import sys
6-
75
import click
86
import requests
97

@@ -38,7 +36,3 @@ def check_for_updates(*args):
3836
)
3937
except requests.RequestException:
4038
pass
41-
42-
43-
def is_bundle():
44-
return getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS')
+7-16
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,21 @@
11
import os
22
import shutil
3+
import stat
34

4-
from cookiecutter import generate
55
from cookiecutter.config import DEFAULT_CONFIG
6-
from cookiecutter.utils import rmtree
6+
7+
8+
def force_delete(func, path, exc_info):
9+
os.chmod(path, stat.S_IWRITE)
10+
func(path)
711

812

913
def purge_cookiecutters_dir():
1014
# Avoid asking rewrite clone boilerplate project
1115
cookie_dir = DEFAULT_CONFIG['cookiecutters_dir']
1216
if os.path.isdir(cookie_dir):
13-
rmtree(cookie_dir)
17+
shutil.rmtree(cookie_dir, onerror=force_delete)
1418

1519

1620
def slugify(name):
1721
return name.lower().strip().replace(' ', '_').replace('-', '_').replace('.', '_').replace(',', '')
18-
19-
20-
def remove_github_actions(project_dir: str):
21-
shutil.rmtree(f'{project_dir}/.github')
22-
23-
24-
def monkey_patch():
25-
def _run_hook_from_repo_dir(
26-
repo_dir, hook_name, project_dir, context, delete_project_on_failure,
27-
): # pragma: no cover
28-
'''Fake method for monkey patching purposes'''
29-
pass
30-
generate._run_hook_from_repo_dir = _run_hook_from_repo_dir

0 commit comments

Comments
 (0)