Package Release #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Package Release | |
on: | |
release: | |
types: [ published ] | |
jobs: | |
source_build: | |
name: Build and publish the source package | |
runs-on: ${{ matrix.os }} | |
if: ${{ github.repository == 'opendilab/LightZero' }} | |
strategy: | |
matrix: | |
os: | |
- 'ubuntu-20.04' | |
python-version: | |
- '3.8.17' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 20 | |
- name: Set up python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up python dependences | |
run: | | |
pip install --upgrade pip | |
pip install --upgrade flake8 setuptools wheel twine | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
if [ -f requirements-build.txt ]; then pip install -r requirements-build.txt; fi | |
if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi | |
pip install --upgrade build | |
- name: Build packages | |
run: | | |
make zip | |
ls -al dist | |
- name: Upload packed files to artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-artifacts-all | |
path: ./dist/* | |
wheel_build: | |
name: Build the wheels | |
runs-on: ${{ matrix.os }} | |
if: ${{ github.repository == 'opendilab/LightZero' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- 'ubuntu-20.04' | |
- 'macos-12' | |
python: | |
- '3.7.17' | |
- '3.8.17' | |
- '3.9.17' | |
- '3.10.17' | |
# - '3.11' | |
architecture: | |
- x86_64 | |
- arm64 | |
- aarch64 | |
- x86 | |
- AMD64 | |
exclude: | |
- os: ubuntu-20.04 | |
architecture: arm64 | |
- os: ubuntu-20.04 | |
architecture: x86 | |
- os: ubuntu-20.04 | |
architecture: AMD64 | |
- os: macos-12 | |
architecture: aarch64 | |
- os: macos-12 | |
architecture: x86 | |
- os: macos-12 | |
architecture: AMD64 | |
- python: '3.7.17' | |
architecture: arm64 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 20 | |
- name: Set up QEMU | |
if: ${{ runner.os == 'Linux' }} | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_SKIP: "pp* *musllinux*" | |
CIBW_ARCHS: ${{ matrix.architecture }} | |
CIBW_PROJECT_REQUIRES_PYTHON: ~=${{ matrix.python }}.0 | |
- name: Show the buildings | |
shell: bash | |
run: | | |
ls -al ./wheelhouse | |
mv wheelhouse dist | |
- name: Upload packed files to artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-artifacts-all | |
path: ./dist/* | |
# the publishing can only be processed on linux system | |
wheel_publish: | |
name: Publish the wheels to pypi | |
runs-on: ubuntu-20.04 | |
needs: | |
- source_build | |
- wheel_build | |
strategy: | |
fail-fast: false | |
matrix: | |
python: | |
- '3.8.17' | |
steps: | |
- name: Download packed files to artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts-all | |
path: ./dist | |
- name: Show the buildings | |
shell: bash | |
run: | | |
ls -al ./dist | |
- name: Publish distribution 📦 to real PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
verbose: true | |
skip_existing: true | |
packages_dir: dist/ | |
- name: Upload distribution 📦 to github release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: dist/* | |
tag: ${{ github.ref }} | |
overwrite: false | |
file_glob: true |