build: install poetry for DEB builds #96
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: Create RPM and DEB packages on release | |
on: | |
push: | |
tags: | |
- '*' | |
release: | |
types: [created] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox tox-gh-actions | |
python -m pip install poetry poetry poetry-plugin-export | |
- name: Test with tox | |
run: tox | |
build-sdist: | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
steps: | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Get cASO repo | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref_name }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install poetry poetry-plugin-export | |
- name: Build sdist file | |
run: poetry build | |
- name: Write release version | |
run: | | |
TAG=${{ github.ref_name }} | |
echo "VERSION=${TAG#v}" >> $GITHUB_ENV | |
- name: Upload sdist to be used for other jobs | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dist/caso-${{ env.VERSION }}.tar.gz | |
name: caso-${{ env.VERSION }}.tar.gz | |
- name: Update source distribution artifacts to release | |
if: github.event_name == 'release' | |
uses: AButler/upload-release-assets@v2.0 | |
with: | |
files: 'dist/*tar.gz' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: ${{ github.ref_name }} | |
build-deb: | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
- build-sdist | |
steps: | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Get cASO repo | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref_name }} | |
- name: Copy debian file into the correct place for the build | |
run: cp -r packaging/debian debian | |
- name: Install Debian deps | |
run: sudo apt-get install -y dpkg-dev debhelper devscripts lintian python3-pip tox dh-python python3-all python3-all-dev python3-pbr pybuild-plugin-pyproject python3-poetry | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install tox tox-gh-actions | |
python -m pip install poetry poetry poetry-plugin-export | |
poetry install | |
- name: Write release version | |
run: | | |
TAG=${{ github.ref_name }} | |
echo "VERSION=${TAG#v}" >> $GITHUB_ENV | |
- name: Download sdist artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: caso-${{ env.VERSION }}.tar.gz | |
path: dist | |
- name: Copy sdist to expected debian source file | |
run: cp dist/caso-${{ env.VERSION }}.tar.gz ../caso-${{ env.VERSION }}.orig.tar.gz | |
- name: Now build package | |
run: dpkg-buildpackage -b | |
- name: debug | |
run: ls | |
- name: debug | |
run: ls .. | |
- name: Update DEB artifacts to release | |
if: github.event_name == 'release' | |
uses: AButler/upload-release-assets@v2.0 | |
with: | |
files: '../*deb' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
release-tag: ${{ github.ref_name }} | |
build-rpm: | |
runs-on: ubuntu-latest | |
needs: | |
- build-sdist | |
- test | |
steps: | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Get cASO repo | |
uses: actions/checkout@v3 | |
with: | |
repository: IFCA/caso | |
ref: ${{ github.ref_name }} | |
- name: Write release version | |
run: | | |
TAG=${{ github.ref_name }} | |
echo "VERSION=${TAG#v}" >> $GITHUB_ENV | |
- name: Download sdist artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: caso-${{ env.VERSION }}.tar.gz | |
path: dist | |
- name: debug | |
run: ls | |
- name: Build RPM package | |
id: rpm | |
uses: alvarolopez/rpmbuild@rockylinux9 | |
with: | |
source_file: dist/caso-${{ env.VERSION }}.tar.gz | |
spec_file: "packaging/redhat/caso.spec" | |
- name: Update RPM artifacts to release | |
if: github.event_name == 'release' | |
uses: AButler/upload-release-assets@v2.0 | |
with: | |
files: '${{ steps.rpm.outputs.rpm_dir_path }}/*/*rpm' | |
repo-token: ${{ secrets.GITHUB_TOKEN }} |