Add renovate.json #155
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: 🚀 CI/CD | |
on: | |
push: | |
jobs: | |
test_and_build: | |
runs-on: ubuntu-18.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Load Cached Poetry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.local | |
key: poetry-dependencies | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-in-project: true | |
- name: Load Cached Python Dependencies | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: python-dependencies-${{ hashFiles('**/poetry.lock') }} | |
- name: Install Python Dependencies | |
run: poetry install | |
- name: Run black | |
run: poetry run black src tests --check | |
- name: Run ruff | |
run: poetry run ruff src tests | |
- name: Run mypy | |
run: poetry run mypy --show-error-codes src | |
- name: Run pytest | |
run: poetry run pytest --cov=src --cov-report=term-missing tests | |
- name: Generate coverage report | |
shell: bash | |
run: poetry run coverage xml | |
- uses: codecov/codecov-action@v2 | |
with: | |
files: ./coverage.xml | |
- name: Build single binary application | |
run: | | |
poetry install --extras pyinstaller | |
poetry run poetry-dynamic-versioning | |
poetry run pyinstaller --onefile src/wakemebot/__main__.py --name wakemebot -s | |
dist/wakemebot version | |
mv dist/wakemebot wakemebot_linux_amd64 | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: wakemebot_linux_amd64 | |
path: wakemebot_linux_amd64 | |
retention-days: 2 | |
publish_release: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [test_and_build] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install clog-cli | |
uses: upciti/wakemeops-action@v1 | |
with: | |
packages: clog-cli | |
- name: Build Release Changelog | |
run: | | |
clog --setversion $(git tag --sort=creatordate | tail -n1) \ | |
--from $(git tag --sort=creatordate | tail -n2 | head -n1) \ | |
-o changelog.md \ | |
-r https://github.com/upciti/wakemebot | |
- name: Download build artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: wakemebot_linux_amd64 | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: changelog.md | |
files: wakemebot_linux_amd64 | |
publish_images: | |
runs-on: ubuntu-latest | |
needs: [test_and_build] | |
if: github.event.repository.fork == false && startsWith(github.ref, 'refs/tags') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Download build artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: wakemebot_linux_amd64 | |
- name: Set execute permission | |
run: chmod +x wakemebot_linux_amd64 | |
- name: Login to GitHub Container Registry | |
if: startsWith(github.ref, 'refs/tags') | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta for images | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ghcr.io/upciti/wakemebot | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=ref,event=branch | |
- name: Build Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
build-args: | | |
WAKEMEBOT_PATH=wakemebot_linux_amd64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Check Docker image | |
run: docker run --rm -i ghcr.io/${{ github.event.repository.full_name }}:latest wakemebot --help | |
- name: Publish Docker image | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
docker push --all-tags ghcr.io/${{ github.event.repository.full_name }} |