1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-23 19:55:38 +01:00

Split up workflows into different parts

This commit is contained in:
Johan Andersson 2020-11-19 21:46:06 +01:00
parent bf1f9c545a
commit 336bf726f2
2 changed files with 126 additions and 30 deletions

View File

@ -1,7 +1,5 @@
name: Tests name: CI
on: [push, pull_request]
on: [push]
jobs: jobs:
tests: tests:
name: ${{ matrix.name }} name: ${{ matrix.name }}
@ -53,35 +51,141 @@ jobs:
- name: pytest - name: pytest
run: pytest -v --cov run: pytest -v --cov
binaries-make:
name: "binaries make"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: update pip
run: |
pip install -U setuptools
python -m pip install -U pip
- name: get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: cache pip
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('setup.py') }}|${{ hashFiles('requirements*.txt') }}
restore-keys: pip-${{ runner.os }}-${{ matrix.python }}-
- name: install deps
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: set version - name: set version
run: python setversion.py run: python setversion.py
# Build .zip fil for *nix # Build .zip fil for *nix
- run: make - run: make
if: matrix.os == 'ubuntu-latest' - run: ./svtplay-dl --version
# Build .exe for windows
- name: build .exe
run: python setup.py build_exe
if: matrix.os == 'windows-latest'
- name: run the .exe file
run: build\\exe.${{ matrix.arch-cx }}-${{ matrix.python }}\\svtplay-dl.exe --version
if: matrix.os == 'windows-latest'
- run: |
mkdir svtplay-dl
xcopy /s build\\exe.${{ matrix.arch-cx }}-${{ matrix.python }} svtplay-dl
if: matrix.os == 'windows-latest'
- run: 7z a -tzip svtplay-dl-${{ matrix.cx_name }}.zip svtplay-dl
if: matrix.os == 'windows-latest'
- name: cibuild - name: cibuild
run: python scripts/cibuild.py run: python scripts/cibuild.py
env: env:
CIBUILD: ${{ matrix.cibuild }} CIBUILD: "yes"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
OS: "ubuntu-latest"
binaries-exe:
name: "binaries exe ${{ matrix.architecture }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {name: Windows, python: '3.8', os: windows-latest, architecture: 'x64', arch-cx: 'win-amd64', cx_name: 'amd64', cibuild: "yes"}
- {name: WindowsX86, python: '3.8', os: windows-latest, architecture: 'x86', arch-cx: 'win32', cx_name: 'win32', cibuild: "yes"}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.architecture }}
- name: update pip
run: |
pip install -U wheel
pip install -U setuptools
python -m pip install -U pip
- name: get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: cache pip
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('setup.py') }}|${{ hashFiles('requirements*.txt') }}
restore-keys: pip-${{ runner.os }}-${{ matrix.python }}-
- name: install deps
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: set version
run: python setversion.py
- name: build .exe
run: python setup.py build_exe
- name: run the .exe file
run: build\\exe.${{ matrix.arch-cx }}-${{ matrix.python }}\\svtplay-dl.exe --version
- run: |
mkdir svtplay-dl
xcopy /s build\\exe.${{ matrix.arch-cx }}-${{ matrix.python }} svtplay-dl
- run: 7z a -tzip svtplay-dl-${{ matrix.cx_name }}.zip svtplay-dl
- name: cibuild
run: python scripts/cibuild.py
env:
CIBUILD: "yes"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
OS: "windows-latest"
binaries-pypi:
name: "binaries pypi"
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: update pip
run: |
pip install -U setuptools
python -m pip install -U pip
- name: get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: cache pip
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip-${{ runner.os }}-${{ matrix.python }}-${{ hashFiles('setup.py') }}|${{ hashFiles('requirements*.txt') }}
restore-keys: pip-${{ runner.os }}-${{ matrix.python }}-
- name: install deps
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: python pkg
run: python setup.py sdist bdist_wheel
- name: cibuild
run: python scripts/cibuild.py
env:
CIBUILD: "yes"
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
OS: ${{ matrix.os }} OS: "ubuntu-latest"

View File

@ -53,12 +53,6 @@ def build_docker():
subprocess.check_call(["docker", "push", docker_name("latest")]) subprocess.check_call(["docker", "push", docker_name("latest")])
def build_package():
logger.info("Building python package")
subprocess.check_output(["python", "setup.py", "sdist", "bdist_wheel"])
def snapshot_folder(): def snapshot_folder():
""" """
Use the commit date in UTC as folder name Use the commit date in UTC as folder name
@ -111,8 +105,6 @@ if not tag() and branch() != "master":
if os.environ.get("CIBUILD") != "yes": if os.environ.get("CIBUILD") != "yes":
sys.exit(0) sys.exit(0)
build_package()
if os.environ.get("OS").startswith("ubuntu"): if os.environ.get("OS").startswith("ubuntu"):
build_docker() build_docker()