Skip to content

🚑 Fix build on Python >= 12 #29

🚑 Fix build on Python >= 12

🚑 Fix build on Python >= 12 #29

Workflow file for this run

name: DevOps
on:
[push, pull_request]
env:
pythonLastVersion: '3.10'
jobs:
##############################################################################
# Test job
#
test_python:
runs-on: ubuntu-latest
name: Test Python
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Make all tests with make
run: make test
##############################################################################
# SonarCloud job
#
test_sonar:
needs: [
test_python
]
runs-on: ubuntu-latest
name: SonarCloud analyse
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: SonarCloud Scan
if: github.event_name != 'pull_request'
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.verbose=true
##############################################################################
# Markdownlint job
#
test_markdownlint:
runs-on: ubuntu-latest
name: MarkdownLint
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: markdownlint-cli
uses: nosborn/github-action-markdown-cli@v3.3.0
with:
files: "*.md docs/*.md"
config_file: ".markdownlint.yaml"
##############################################################################
# SonarCloud job
#
package:
needs: [
test_python,
test_sonar,
test_markdownlint
]
runs-on: ubuntu-latest
name: Build package
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up Python ${{ env.pythonLastVersion }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.pythonLastVersion }}
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Package
run: make dist
- name: Archive package
uses: actions/upload-artifact@v4
with:
name: seedboxsync-${{ github.sha }}.tar.gz
path: dist/*.tar.gz
##############################################################################
# Realse job
#
release:
needs: [
package,
]
runs-on: ubuntu-latest
if: contains(github.ref, 'refs/tags/v')
name: Release on GitHub and PyPi
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Set up Python ${{ env.pythonLastVersion }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.pythonLastVersion }}
- uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev-requirements.txt') }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Package
run: make dist
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: true
prerelease: false
- name: Upload asset in GitHub release
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: dist/seedboxsync-${{ env.RELEASE_VERSION }}.tar.gz
asset_name: seedboxsync-${{ env.RELEASE_VERSION }}.tar.gz
asset_content_type: application/tar+gzip
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}