buidl wheel in linux job

This commit is contained in:
Jesse Bannon 2023-02-22 19:31:19 -08:00
parent bdc1f1f184
commit 73fe5687c3

View file

@ -69,11 +69,15 @@ jobs:
- name: Install and Package - name: Install and Package
run: | run: |
pip install -e .[build] pip install -e .[build]
# Build executable
pyinstaller ytdl-sub.spec pyinstaller ytdl-sub.spec
mkdir -p /opt/builds mkdir -p /opt/builds
mv dist/ytdl-sub /opt/builds/ytdl-sub_linux mv dist/ytdl-sub /opt/builds/ytdl-sub_linux
@ Build wheel
mkdir -p /opt/wheels
python3 -m build python3 -m build
ls -lh dist/ mv dist/ytdl-sub-${{ needs.version.outputs.pypi_version }}.tar.gz /opt/wheels
mv dist/ytdl-sub-${{ needs.version.outputs.pypi_version }}-py3-none-any.whl /opt/wheels
- name: Save build to cache - name: Save build to cache
uses: actions/cache@v3 uses: actions/cache@v3
@ -81,6 +85,18 @@ jobs:
path: /opt/builds/ytdl-sub_linux path: /opt/builds/ytdl-sub_linux
key: ${{ github.sha }}-linux key: ${{ github.sha }}-linux
- name: Save wheel to cache
uses: actions/cache@v3
with:
path: /opt/wheels/ytdl-sub-${{ needs.version.outputs.pypi_version }}-py3-none-any.whl
key: ${{ github.sha }}-wheel
- name: Save targz to cache
uses: actions/cache@v3
with:
path: /opt/wheels/ytdl-sub-${{ needs.version.outputs.pypi_version }}.tar.gz
key: ${{ github.sha }}-targz
build-arm: build-arm:
name: build-arm name: build-arm
needs: needs:
@ -104,17 +120,14 @@ jobs:
# Mount the artifacts directory as /artifacts in the container # Mount the artifacts directory as /artifacts in the container
dockerRunArgs: | dockerRunArgs: |
--volume "/opt/builds:/builds" --volume "/opt/builds:/builds"
--volume "/opt/wheels:/wheels"
# Set an output parameter `uname` for use in subsequent steps # Set an output parameter `uname` for use in subsequent steps
run: | run: |
apk add python3 python3-dev py3-pip musl-dev libc-dev libffi-dev gcc g++ pwgen zlib-dev rust cargo apk add python3 python3-dev py3-pip musl-dev libc-dev libffi-dev gcc g++ pwgen zlib-dev rust cargo
pip3 install --upgrade pip pip3 install --upgrade pip
pip3 install -e .[build] pip3 install pyinstaller
pyinstaller --log-level=DEBUG ytdl-sub.spec pyinstaller --log-level=DEBUG ytdl-sub.spec
mv dist/ytdl-sub /builds/ytdl-sub_${{ matrix.arch }} mv dist/ytdl-sub /builds/ytdl-sub_${{ matrix.arch }}
python3 -m build
ls -lh dist/
- name: Save build to cache - name: Save build to cache
uses: actions/cache@v3 uses: actions/cache@v3
@ -181,31 +194,31 @@ jobs:
pypi-publish: pypi-publish:
name: pypi-publish name: pypi-publish
needs: needs:
- version - build-linux
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [ "3.10" ]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with: with:
fetch-depth: 0 # Needed for correct commit count. TODO: define once using GH actions python-version: "3.10"
ref: master
- name: Write version to init file
run: |
echo '${{ needs.version.outputs.init_contents }}' > src/ytdl_sub/__init__.py
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Build Wheel - name: Restore wheel
run: | uses: actions/cache@v3
make wheel with:
path: /opt/wheels/ytdl-sub-${{ needs.version.outputs.pypi_version }}-py3-none-any.whl
key: ${{ github.sha }}-wheel
- name: Restore targz
uses: actions/cache@v3
with:
path: /opt/wheels/ytdl-sub-${{ needs.version.outputs.pypi_version }}.tar.gz
key: ${{ github.sha }}-targz
- name: Publish distribution 📦 to PyPI - name: Publish distribution 📦 to PyPI
if: ${{ github.ref == 'refs/heads/master' }} if: ${{ github.ref == 'refs/heads/master' }}
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
with: with:
password: ${{ secrets.PYPI_API_TOKEN }} password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: /opt/wheels