Skip to content

Commit

Permalink
Include packaging workflows and update jobs
Browse files Browse the repository at this point in the history
Now we also force testing before releasing and building
  • Loading branch information
alvarolopez committed Mar 17, 2022
1 parent d6604bf commit d4aa932
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 5 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Create RPM and DEB packages on release

on:
release:
types: [created]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox

build-deb:
runs-on: ubuntu-latest
needs: test
steps:
- 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: Build Debian package
uses: alvarolopez/action-debian-python-package@v3
with:
artifacts_directory: output
os_distribution: stable

- name: Update DEB artifacts to release
uses: AButler/upload-release-assets@v2.0
with:
files: 'output/*deb'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.ref_name }}

build-rpm:
runs-on: ubuntu-latest
needs: test
steps:
- name: Get cASO repo
uses: actions/checkout@v3
with:
repository: IFCA/caso
ref: ${{ github.ref_name }}

- name: Build sdist to use as source
run: python setup.py sdist

- name: Build RPM package
id: rpm
uses: alvarolopez/rpmbuild@rockylinux8
with:
source_file: dist/caso-${{ github.ref_name}}.tar.gz
spec_file: "packaging/redhat/caso.spec"

- name: Update RPM artifacts to release
uses: AButler/upload-release-assets@v2.0
with:
files: '${{ steps.rpm.outputs.rpm_dir_path }}/*/*rpm'
repo-token: ${{ secrets.GITHUB_TOKEN }}
30 changes: 27 additions & 3 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,44 @@ on:
types: [created]

jobs:
deploy:

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox

publish:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@ on:
- pull_request

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox

0 comments on commit d4aa932

Please sign in to comment.