diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b7c7bab..ae975bc 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,7 +1,5 @@ -name: Tests - -on: [push] - +name: CI +on: [push, pull_request] jobs: tests: name: ${{ matrix.name }} @@ -53,35 +51,141 @@ jobs: - name: pytest 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 run: python setversion.py # Build .zip fil for *nix - run: make - if: matrix.os == 'ubuntu-latest' - - # 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' - + - run: ./svtplay-dl --version - name: cibuild run: python scripts/cibuild.py 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_PASSWORD: ${{ secrets.TWINE_PASSWORD }} DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - OS: ${{ matrix.os }} + OS: "ubuntu-latest" diff --git a/scripts/cibuild.py b/scripts/cibuild.py index 7174f22..3a32f86 100755 --- a/scripts/cibuild.py +++ b/scripts/cibuild.py @@ -53,12 +53,6 @@ def build_docker(): 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(): """ 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": sys.exit(0) -build_package() - if os.environ.get("OS").startswith("ubuntu"): build_docker()