Attach macOS and Linux binaries to release

This commit is contained in:
sebthom
2022-01-30 09:25:32 +01:00
parent 1e1cffeab7
commit ea04b85007
6 changed files with 117 additions and 57 deletions

View File

@@ -12,6 +12,7 @@ on:
- '**'
paths-ignore:
- '**/*.md'
- '.github/*.yml'
pull_request:
workflow_dispatch:
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
@@ -21,7 +22,10 @@ defaults:
shell: bash
jobs:
###########################################################
build:
###########################################################
strategy:
fail-fast: false
matrix:
@@ -29,8 +33,11 @@ jobs:
- macos-latest
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Git Checkout
uses: actions/checkout@v2 #https://github.com/actions/checkout
@@ -83,15 +90,6 @@ jobs:
pdm run app version
pdm run app verify
- name: "Build docker image"
if: startsWith(matrix.os, 'linux')
run: |
set -eux
bash docker/build-image.sh
docker run --rm kleinanzeigen-bot/kleinanzeigen-bot help
- name: "Install: binutils (strip)"
if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get --no-install-recommends install -y binutils
@@ -123,7 +121,6 @@ jobs:
;;
esac
- name: pyinstaller
run: |
set -eux
@@ -132,17 +129,48 @@ jobs:
ls -l dist
- name: run kleinanzeigen_bot.exe
if: startsWith(matrix.os, 'windows')
- name: run self-contained executable
run: |
set -eux
dist/kleinanzeigen-bot.exe help
dist/kleinanzeigen-bot.exe version
dist/kleinanzeigen-bot.exe verify
dist/kleinanzeigen-bot help
dist/kleinanzeigen-bot version
dist/kleinanzeigen-bot verify
- name: "Share: self-contained executable"
uses: actions/upload-artifact@v2
with:
name: artifacts-${{ matrix.os }}
path: dist/kleinanzeigen-bot*
- name: "Build docker image"
if: startsWith(matrix.os, 'ubuntu')
run: |
set -eux
bash docker/build-image.sh
docker run --rm kleinanzeigen-bot/kleinanzeigen-bot help
###########################################################
publish-release:
###########################################################
runs-on: ubuntu-latest
needs:
- build
if: github.ref == 'refs/heads/main'
concurrency: publish-latest-release # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idconcurrency
steps:
- name: "SCM Checkout"
# only required by "hub release create" to prevent "fatal: Not a git repository"
uses: actions/checkout@v2 #https://github.com/actions/checkout
- name: "Get: all build artifacts"
uses: actions/download-artifact@v2
- name: "Delete previous 'latest' release"
if: startsWith(matrix.os, 'windows') && github.ref == 'refs/heads/main'
run: |
set -eu
@@ -163,17 +191,22 @@ jobs:
fi
- name: "Create 'latest' Release"
if: startsWith(matrix.os, 'windows') && github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eux
mv artifacts-macos-latest/kleinanzeigen-bot kleinanzeigen-bot-darwin-amd64
mv artifacts-ubuntu-latest/kleinanzeigen-bot kleinanzeigen-bot-linux-amd64
mv artifacts-windows-latest/kleinanzeigen-bot.exe kleinanzeigen-bot-windows-amd64.exe
# https://hub.github.com/hub-release.1.html
hub release create "latest" \
--prerelease \
--message "latest" \
--attach "dist/kleinanzeigen-bot.exe#kleinanzeigen-bot.exe"
--attach "kleinanzeigen-bot-darwin-amd64" \
--attach "kleinanzeigen-bot-linux-amd64" \
--attach "kleinanzeigen-bot-windows-amd64.exe"
- name: "Delete intermediate build artifacts"
uses: geekyeggo/delete-artifact@1-glob-support # https://github.com/GeekyEggo/delete-artifact/

View File

@@ -26,28 +26,47 @@ It is a spiritual successor to [AnzeigenOrg/ebayKleinanzeigen](https://github.co
- use globbing (wildcards) to select images from local disk
- reference categories by name (looked up from [categories.yaml](https://github.com/kleinanzeigen-bot/kleinanzeigen-bot/blob/main/kleinanzeigen_bot/resources/categories.yaml))
- logging is configurable and colorized
- provided as self-contained Windows executable [kleinanzeigen-bot.exe](https://github.com/kleinanzeigen-bot/kleinanzeigen-bot/releases/download/latest/kleinanzeigen-bot.exe)
- provided as self-contained executable for Windows, Linux and macOS
- source code is pylint checked and uses Python type hints
- CI builds
## <a name="installation"></a>Installation
### Installation on Windows using self-containing exe
### Installation using pre-compiled exe
1. The following components need to be installed:
1. [Chromium](https://www.chromium.org/getting-involved/download-chromium), [Google Chrome](https://www.google.com/chrome/),
or Chromium based [Microsoft Edge](https://www.microsoft.com/edge) browser
1. Open a command/terminal window
1. Download the app using
```
curl https://github.com/kleinanzeigen-bot/kleinanzeigen-bot/releases/download/latest/kleinanzeigen-bot.exe -o kleinanzeigen-bot.exe
```
1. Run the app:
```
kleinanzeigen-bot --help
```
1. Download and run the app by entering the following commands:
1. On Windows:
```batch
curl https://github.com/kleinanzeigen-bot/kleinanzeigen-bot/releases/download/latest/kleinanzeigen-bot-windows-amd64.exe -o kleinanzeigen-bot.exe
kleinanzeigen-bot --help
```
1. On Linux:
```shell
curl https://github.com/kleinanzeigen-bot/kleinanzeigen-bot/releases/download/latest/kleinanzeigen-bot-linux-amd64 -o kleinanzeigen-bot
chmod 655 kleinanzeigen-bot
./kleinanzeigen-bot --help
```
1. On macOS:
```shell
curl https://github.com/kleinanzeigen-bot/kleinanzeigen-bot/releases/download/latest/kleinanzeigen-bot-darwin-amd64 -o kleinanzeigen-bot
chmod 655 kleinanzeigen-bot
./kleinanzeigen-bot --help
```
### Installation from source
@@ -71,7 +90,7 @@ It is a spiritual successor to [AnzeigenOrg/ebayKleinanzeigen](https://github.co
```bash
pip install pdm
# temporary workaround for https://github.com/pdm-project/pdm/issues/728#issuecomment-1021771200
# temporary workaround for https://github.com/SeleniumHQ/selenium/issues/10022 / https://github.com/pdm-project/pdm/issues/728#issuecomment-1021771200
pip install -t __pypackages__/3.10/lib selenium
pdm install

View File

@@ -62,7 +62,7 @@ RUN cd /opt/app \
&& ls -la . \
# https://github.com/python/mypy/issues/11829
&& pip install -t __pypackages__/3.10/lib git+git://github.com/python/mypy.git@9b3147701f054bf8ef42bd96e33153b05976a5e1 \
# https://github.com/pdm-project/pdm/issues/728#issuecomment-1021771200
# https://github.com/SeleniumHQ/selenium/issues/10022 / https://github.com/pdm-project/pdm/issues/728#issuecomment-1021771200
&& pip install -t __pypackages__/3.10/lib selenium \
&& pdm install \
&& ls -la kleinanzeigen_bot \

View File

@@ -13,6 +13,34 @@ datas = [
* collect_data_files("selenium_stealth"), # embeds *.js files
]
excluded_modules = [
"_aix_support",
"argparse",
"backports",
"bz2",
"cryptography.hazmat",
"distutils",
"doctest",
"ftplib",
"lzma",
"pep517",
"pdb",
"pip",
"pydoc",
"pydoc_data",
"optparse",
"setuptools",
"six",
"statistics",
"test",
"unittest",
"xml.sax"
]
from sys import platform
if platform != "darwin":
excluded_modules.append("_osx_support")
block_cipher = None
analysis = Analysis(
@@ -24,30 +52,7 @@ analysis = Analysis(
hookspath = [],
hooksconfig = {},
runtime_hooks = [],
excludes = [
"_aix_support",
"_osx_support",
"argparse",
"backports",
"bz2",
"cryptography.hazmat",
"distutils",
"doctest",
"ftplib",
"lzma",
"pep517",
"pdb",
"pip",
"pydoc",
"pydoc_data",
"optparse",
"setuptools",
"six",
"statistics",
"test",
"unittest",
"xml.sax"
],
excludes = excluded_modules,
win_no_prefer_redirects = False,
win_private_assemblies = False,
cipher = block_cipher,

View File

@@ -67,7 +67,7 @@ dev = [
[tool.pdm.scripts]
app = "python -m kleinanzeigen_bot"
bandit = "bandit -c pyproject.toml -r kleinanzeigen_bot"
pyinstaller = "pyinstaller pyinstaller.spec --clean"
pyinstaller = "python -O -m PyInstaller pyinstaller.spec --clean"
pylint = "pylint kleinanzeigen_bot"
pytest = "python -m pytest -v"

View File

@@ -2,7 +2,7 @@
Copyright (C) 2022 Sebastian Thomschke and contributors
SPDX-License-Identifier: AGPL-3.0-or-later
"""
import time
import os, sys, time
from kleinanzeigen_bot import utils
@@ -10,4 +10,7 @@ def test_pause():
start = time.time()
utils.pause(100, 100)
elapsed = 1000 * (time.time() - start)
assert 99 < elapsed < 110
if sys.platform == "darwin" and os.getenv("GITHUB_ACTIONS", "true") == "true":
assert 99 < elapsed < 300
else:
assert 99 < elapsed < 110