Skip to content

Commit

Permalink
CI - Switch from GitLab to GitHub (#1)
Browse files Browse the repository at this point in the history
* Add autolabeler and dependabot

* Add linter and doc builder

* Replace gitlab ref by github

* Remove gitlab configuration

* Push new workflows

* Remove azure ci

* Version

* Change settings path

* use pytest as module
  • Loading branch information
Guts authored Jul 22, 2021
1 parent 3111f23 commit 4342cee
Show file tree
Hide file tree
Showing 15 changed files with 275 additions and 246 deletions.
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/requirements"
schedule:
interval: monthly
time: "17:00"
timezone: Europe/Paris
labels:
- dependencies

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
labels:
- ci-cd
9 changes: 9 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ci-cd:
- .github/**/*

dependencies:
- ./requirements.txt
- ./requirements/*.txt

documentation:
- docs/**/*
88 changes: 88 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: "📦 Build"

# Triggers
on:
push:
branches: [main]

paths:
- ".github/workflows/build.yml"
- "builder/**/*"
- "qgis_deployment_toolbelt/**/*.py"

tags: "*"

# Globals
env:
PROJECT_FOLDER: "qgis_deployment_toolbelt"
PYTHON_VERSION: 3.8
PYINSTALLER_LOG_LEVEL: "DEBUG"

# Jobs definition
jobs:
build-windows:
name: "📦 Windows"

runs-on: windows-latest

steps:
- name: Get source code
uses: actions/checkout@v2

- name: Install project requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/base.txt
python -m pip install -U -r requirements/development.txt
- name: Install project as a package
run: python -m pip install -e .

- name: Generates MS Version Info
run: python .\builder\version_info_templater.py

- name: Generates MS Executable
run: python -O .\builder\pyinstaller_build_windows.py

- name: Save it as artifact
uses: actions/upload-artifact@v2
with:
name: qgis_deployment_toolbelt_windows_executable
path: dist/qgis_deployment_toolbelt*

release:
name: "Release on tag 🚀"

runs-on: ubuntu-latest

needs: [build-windows]

if: startsWith(github.ref, 'refs/tags/')

steps:
- uses: actions/download-artifact@v2
with:
name: qgis_deployment_toolbelt_windows_executable
path: builds/windows/

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: "Version ${{ github.ref }}"
draft: false
prerelease: false

- name: Add Windows executable as release Asset
id: upload-release-asset-windows
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: builds/windows/
asset_name: qgis_deployment_toolbelt_windows_executable.zip
asset_content_type: application/zip
46 changes: 46 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "📚 Documentation"

on:
push:
branches: [main]
paths:
- "docs/**/*"
- ".github/workflows/documentation.yml"
- "qgis_deployment_toolbelt/**/*.py"

env:
PYTHON_VERSION: 3.8

jobs:
build-docs:
runs-on: ubuntu-20.04

steps:
- name: Get source code
uses: actions/checkout@v2

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

- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install project requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/base.txt
python -m pip install -U -r requirements/development.txt
python -m pip install -U -r requirements/documentation.txt
python -m pip install -e .
- name: Build doc using Sphinx
run: sphinx-build -b html docs docs/_build/html

- name: Deploy to GitHub Pages
run: ghp-import --force --no-history --no-jekyll --push docs/_build/html
46 changes: 46 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 🐍 Linter

on:
push:
branches: [main]
paths:
- "**.py"

pull_request:
branches: [main]
paths:
- "**.py"

env:
PROJECT_FOLDER: "qgis_deployment_toolbelt"
PYTHON_VERSION: 3.8

jobs:
lint-ubuntu:
runs-on: ubuntu-20.04

steps:
- name: Get source code
uses: actions/checkout@v2

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

- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U "flake8>=3.7,<3.9"
- name: Lint with flake8
run: |
flake8 ${{ env.PROJECT_FOLDER }} --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 ${{ env.PROJECT_FOLDER }} --count --exit-zero --statistics
12 changes: 12 additions & 0 deletions .github/workflows/pr-auto-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "🏷 PR Labeler"
on:
- pull_request_target

jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
52 changes: 52 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "🎳 Tester"

on:
push:
branches: [main]
paths:
- "**/*.py"
- ".github/workflows/tests.yml"
pull_request:
branches: [main]
paths:
- "**/*.py"
- ".github/workflows/tests.yml"

env:
PROJECT_FOLDER: "qgis_deployment_toolbelt"
PYTHON_VERSION: 3.8

jobs:
unit-test:
runs-on: ubuntu-20.04

steps:
- name: Get source code
uses: actions/checkout@v2

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

- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install project requirements
run: |
python -m pip install -U pip setuptools wheel
python -m pip install -U -r requirements/base.txt
python -m pip install -U -r requirements/development.txt
- name: Install project as a package
run: python -m pip install -e .

- name: Unit tests
run: python -m pytest

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
Loading

0 comments on commit 4342cee

Please sign in to comment.