Migrate conanfile to conan2 (#364) #25
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: Lanelet2 CD | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
# this should be kept in sync with ci.yaml | |
python-version: ["3.8", "3.9", "3.10", "3.11"] | |
include: | |
- python-version: "3.8" | |
platform-version: manylinux_2_27_x86_64 | |
image-version: conanio/gcc7:latest | |
- python-version: "3.9" | |
platform-version: manylinux_2_27_x86_64 | |
image-version: conanio/gcc7:latest | |
- python-version: "3.10" | |
platform-version: manylinux_2_31_x86_64 | |
image-version: conanio/gcc10:latest | |
- python-version: "3.11" | |
platform-version: manylinux_2_31_x86_64 | |
image-version: conanio/gcc10:latest | |
- python-version: "3.12" | |
platform-version: manylinux_2_31_x86_64 | |
image-version: conanio/gcc10:latest | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup docker buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Create build container | |
uses: docker/build-push-action@v3 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
file: .github/conan_dockerfile/Dockerfile | |
tags: lanelet2_conan_with_pip_wheel | |
load: true | |
target: lanelet2_conan_with_pip_wheel | |
build-args: | | |
FROM=${{ matrix.image-version }} | |
PY_VERSION=${{ matrix.python-version }} | |
PLATFORM=${{ matrix.platform-version }} | |
- name: Create output directory | |
run: mkdir -p ${{ github.workspace }}/output | |
- name: Package lanelet2 in build container | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: lanelet2_conan_with_pip_wheel | |
shell: bash | |
options: -v ${{ github.workspace }}/dist:/dist | |
run: | | |
set -e | |
# set env variables | |
export HOME=/home/conan | |
# copy wheel to dist directory | |
sudo cp -r $HOME/dist/* /dist | |
- name: Store wheel | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
test: | |
needs: build | |
strategy: | |
matrix: | |
# test only on currently supported version | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
os: ["ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Restore wheel | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install wheel 24.04 | |
# use dist/ directory as package source instead of pypi.org | |
if: ${{ matrix.os == 'ubuntu-24.04' }} | |
run: pip install lanelet2 --break-system-packages --no-index --find-links dist/ | |
- name: Install wheel | |
# use dist/ directory as package source instead of pypi.org | |
if: ${{ matrix.os != 'ubuntu-24.04' }} | |
run: pip install lanelet2 --no-index --find-links dist/ | |
- name: Test wheel | |
run: python -c "import lanelet2; assert lanelet2.core.Point2d(0, 0, 0) is not None" | |
publish: | |
if: contains(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: [build, test] | |
steps: | |
- name: Restore wheel | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist/ | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: dist/* | |
- name: Publish package to PyPI | |
if: github.repository == 'fzi-forschungszentrum-informatik/Lanelet2' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
deploy-pages: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' | |
concurrency: deploy-${{ github.ref }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: set up python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: set up env | |
run: python -m pip install -r docs/requirements.txt | |
- name: copy docs to docs folder | |
run: bash docs/cp_docu_files.sh | |
- run: mkdocs gh-deploy --force |