GitHub actions release test #43
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: Griddly Build | |
on: | |
push: | |
branches: ["master", "develop"] | |
# Run on all pull requests | |
pull_request: | |
jobs: | |
# build-wasm: | |
# runs-on: ubuntu-latest | |
# steps: | |
# # Checkout the repository | |
# - name: Checkout | |
# uses: actions/checkout@v2 | |
# # Install Conan | |
# - name: Install Conan | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install python3-pip | |
# pip3 install conan | |
# # Configure conan for release build | |
# - name: Configure Build | |
# run: | | |
# ./configure.sh | |
build-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
manylinux_config: | |
- python-version: "3.8" | |
py-bin: cp38-cp38 | |
platform: manylinux_2_28_x86_64 | |
- python-version: "3.9" | |
py-bin: cp39-cp39 | |
platform: manylinux_2_28_x86_64 | |
- python-version: "3.10" | |
py-bin: cp310-cp310 | |
platform: manylinux_2_28_x86_64 | |
# - python-version: "3.11" | |
# py-bin: cp311-cp311 | |
# platform: manylinux_2_28_x86_64 | |
- python-version: "3.8" | |
py-bin: cp38-cp38 | |
platform: manylinux2014_x86_64 | |
- python-version: "3.9" | |
py-bin: cp39-cp39 | |
platform: manylinux2014_x86_64 | |
- python-version: "3.10" | |
py-bin: cp310-cp310 | |
platform: manylinux2014_x86_64 | |
container: | |
image: quay.io/pypa/${{ matrix.manylinux_config.platform }} | |
env: | |
PYBIN: ${{ matrix.manylinux_config.py-bin }} | |
PYVERSION: ${{ matrix.manylinux_config.python-version }} | |
PLATFORM: ${{ matrix.manylinux_config.platform }} | |
steps: | |
# Checkout the repository | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# # Set python version | |
# - name: Set up Python | |
# uses: actions/setup-python@v3 | |
# with: | |
# python-version: ${{ matrix.manylinux_config.python-version }} | |
# Install Conan | |
- name: Install Build Dependencies | |
run: | | |
/opt/python/$PYBIN/bin/pip install poetry cmake conan==1.59.0 | |
# Configure conan for release build | |
- name: Build | |
run: | | |
export CONAN_SYSREQUIRES_SUDO=0 | |
export PATH=$PATH:/opt/python/$PYBIN/bin | |
/opt/python/$PYBIN/bin/conan install deps/conanfile.txt -pr:b=default -pr:h=default -pr:h=deps/build.profile -s build_type=Release --build=* -if build_manylinux | |
/opt/python/$PYBIN/bin/cmake . -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DPython_ROOT_DIR:STRING=/opt/python/$PYBIN -DPYTHON_EXECUTABLE:FILEPATH=/opt/python/$PYBIN/bin/python -S . -B build_manylinux | |
/opt/python/$PYBIN/bin/cmake --build build_manylinux --config Release | |
# Run the tests | |
- name: Test | |
run: | | |
export GTEST_FILTER=-*BlockObserverTest*:*SpriteObserverTest* | |
/opt/python/$PYBIN/bin/ctest --test-dir build_manylinux | |
# Setup python environment | |
- name: Poetry install | |
run: | | |
cd python | |
/opt/python/$PYBIN/bin/poetry install | |
# Run python tests | |
- name: Python tests | |
run: | | |
cd python | |
/opt/python/$PYBIN/bin/poetry run pytest . | |
- name: Python Package | |
if: github.ref == 'refs/heads/master' || contains(github.head_ref, 'release-test') | |
run: | | |
cd python | |
/opt/python/$PYBIN/bin/poetry build --format=wheel | |
# Upload the built wheels | |
- name: Upload wheel artifacts | |
if: github.ref == 'refs/heads/master' || contains(github.head_ref, 'release-test') | |
uses: actions/upload-artifact@v3 | |
with: | |
path: python/dist/*.whl | |
publish-wheels: | |
if: github.ref == 'refs/heads/master' || contains(github.head_ref, 'release-test') | |
needs: build-linux | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download wheel artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: python/dist | |
- name: List wheels | |
run: | | |
ls -lah python/dist | |
- name: List wheels 2 | |
run: | | |
ls -lah python/dist/artifact | |
mv python/dist/artifact/*.whl python/dist/ | |
- name: Install Build Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install python3-pip | |
pip3 install poetry | |
- name: Pypi upload (test) | |
if: contains(github.head_ref, 'release-test') | |
run: | | |
cd python | |
poetry config repositories.test-pypi https://test.pypi.org/legacy/ | |
poetry config pypi-token.test-pypi ${{ secrets.PYPI_TEST_TOKEN }} | |
poetry publish -r test-pypi | |
- name: Pypi upload (prod) | |
if: github.ref == 'refs/heads/master' | |
run: | | |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | |
poetry publish | |
# build-macos: | |
# runs-on: macos-latest | |
# build-windows: | |
# runs-on: windows-latest |