-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from chelnak/exporter_refresh
Exporter refresh
- Loading branch information
Showing
25 changed files
with
1,320 additions
and
452 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: "Release Prep" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: "The version number for the next release." | ||
required: true | ||
type: choice | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
target: | ||
description: "The target for the release. This can be a commit sha or a branch." | ||
required: false | ||
default: "main" | ||
type: "string" | ||
|
||
jobs: | ||
release_prep: | ||
name: "release prep" | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
|
||
- name: "checkout" | ||
uses: "actions/checkout@v3" | ||
with: | ||
ref: ${{ github.event.inputs.target }} | ||
clean: true | ||
fetch-depth: 0 | ||
|
||
- name: "set up python" | ||
uses: "actions/setup-python@v2" | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: "install poetry" | ||
uses: "snok/install-poetry@v1" | ||
with: | ||
virtualenvs-in-project: true | ||
|
||
- name: "install dependencies" | ||
run: | | ||
poetry install | ||
- name: "bump version" | ||
id: "bump_version" | ||
run: | | ||
next_version=$(poetry version ${{ github.event.inputs.version }} -s) | ||
echo "version=$next_version" >> $GITHUB_OUTPUT | ||
- name: "generate changelog" | ||
run: | | ||
export GH_HOST=github.com | ||
gh extension install chelnak/gh-changelog | ||
gh changelog new --next-version v${{ steps.bump_version.outputs.version }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: "commit changes" | ||
run: | | ||
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com" | ||
git config --local user.name "GitHub Actions" | ||
git add . | ||
git commit -m "Release prep v${{ steps.bump_version.outputs.version }}" | ||
- name: "create pull request" | ||
uses: "peter-evans/create-pull-request@v4" | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: "Release prep v${{ steps.bump_version.outputs.version }}" | ||
branch: "release-prep" | ||
delete-branch: true | ||
title: "Release prep v${{ steps.bump_version.outputs.version }}" | ||
base: "main" | ||
body: | | ||
Automated release-prep from commit ${{ github.sha }}. | ||
labels: "maintenance" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
- id: check-toml | ||
- repo: https://github.com/psf/black | ||
rev: 22.10.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.10.1 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/terrencepreilly/darglint | ||
rev: master | ||
hooks: | ||
- id: darglint |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
FROM python:3.7.4-alpine3.10 | ||
FROM python:3.10-alpine | ||
|
||
ADD exporter exporter/ | ||
ADD requirements.txt exporter/requirements.txt | ||
|
||
WORKDIR exporter | ||
|
||
RUN pip install -r requirements.txt | ||
COPY dist/ /tmp/ | ||
RUN pip install --no-cache-dir /tmp/status_cake_exporter*.whl | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["python", "app.py"] | ||
ENTRYPOINT ["status-cake-exporter"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.DEFAULT_GOAL:= build | ||
SHELL := /bin/bash | ||
VENV ?= "$(shell poetry env list --full-path | cut -f1 -d " ")/bin/activate" | ||
|
||
# Releasing | ||
tag: | ||
@git tag -a $(version) -m "Release $(version)" | ||
@git push --follow-tags | ||
|
||
# Building | ||
build: check | ||
@source $(VENV) | ||
@rm -rf dist || true | ||
@poetry build | ||
|
||
check: | ||
@source $(VENV) | ||
@poetry run black --check . | ||
@poetry run isort --check . | ||
@poetry run flake8 status_cake_exporter --max-line-length=120 --tee | ||
@poetry run darglint -s google -m "{path}:{line} -> {msg_id}: {msg}" status_cake_exporteri | ||
|
||
|
||
# Developing | ||
.PHONY: init | ||
init: | ||
@poetry install | ||
@pre-commit install | ||
|
||
.PHONY: fix | ||
fix: | ||
@source $(VENV) | ||
@poetry run black . | ||
@poetry run isort . |
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
Oops, something went wrong.