Skip to content

Commit

Permalink
feat: initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Oct 15, 2023
1 parent eb4a71d commit 8f61f45
Show file tree
Hide file tree
Showing 21 changed files with 1,460 additions and 0 deletions.
135 changes: 135 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
name: CI

on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
push:
branches: [master]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pytest:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade -r requirements.txt
python -m pip install --upgrade -r requirements-dev.txt
- name: Test with pytest
id: test
shell: bash
run: |
python -m pytest \
-rxXs \
--tb=native \
--verbose \
--cov=action \
tests
- name: Upload coverage
# any except cancelled or skipped
if: >-
always() &&
(steps.test.outcome == 'success' || steps.test.outcome == 'failure') &&
(matrix.docker == false)
uses: codecov/codecov-action@v3
with:
flags: ${{ matrix.os }}

action:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
set:
- '0'
- '1'

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run Action
id: action
uses: ./
with:
changelog_path: ./tests/data/set${{ matrix.set }}/CHANGELOG.md

- name: Print action outputs
shell: bash
run: |
echo "changelog_exists: ${{ steps.action.outputs.changelog_exists }}"
echo "changelog_changes: ${{ steps.action.outputs.changelog_changes }}"
echo "changelog_date: ${{ steps.action.outputs.changelog_date }}"
echo "changelog_url: ${{ steps.action.outputs.changelog_url }}"
echo "changelog_version: ${{ steps.action.outputs.changelog_version }}"
echo "changelog_release_exists: ${{ steps.action.outputs.changelog_release_exists }}"
echo "publish_stable_release: ${{ steps.action.outputs.publish_stable_release }}"
echo "release_version: ${{ steps.action.outputs.release_version }}"
echo "release_build: ${{ steps.action.outputs.release_build }}"
echo "release_tag: ${{ steps.action.outputs.release_tag }}"
- name: Verify changelog_exists
shell: bash
run: |
if [[ "${{ steps.action.outputs.changelog_exists }}" != "true" ]]; then
echo "changelog_exists is not true"
exit 1
fi
- name: Verify changelog_changes
shell: bash
run: |
expected_changes=$(cat ./tests/data/set${{ matrix.set }}/changes.txt)
if [[ "${{ steps.action.outputs.changelog_changes }}" != "{expected_changes}" ]]; then
echo "changelog_changes does not match expected"
exit 1
fi
- name: Verify changelog_date
shell: bash
run: |
expected_date=$(cat ./tests/data/set${{ matrix.set }}/date.txt)
if [[ "${{ steps.action.outputs.changelog_date }}" != "{expected_date}" ]]; then
echo "changelog_date does not match expected"
exit 1
fi
- name: Verify changelog_url
shell: bash
run: |
expected_url=$(cat ./tests/data/set${{ matrix.set }}/url.txt)
if [[ "${{ steps.action.outputs.changelog_url }}" != "{expected_url}" ]]; then
echo "changelog_url does not match expected"
exit 1
fi
- name: Verify changelog_version
shell: bash
run: |
expected_version=$(cat ./tests/data/set${{ matrix.set }}/version.txt)
if [[ "${{ steps.action.outputs.changelog_version }}" != "{expected_version}" ]]; then
echo "changelog_version does not match expected"
exit 1
fi
164 changes: 164 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# project specific ignores
github_*.md
github/
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM python:3.12-alpine3.18 AS base

RUN python -m pip install --upgrade pip setuptools wheel

ADD . /app
ADD ${GITHUB_WORKSPACE} /app/github/workspace

RUN python -m pip install --upgrade -r requirements.txt

WORKDIR /app

CMD ["/app/action/main.py"]
36 changes: 36 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: "Setup Release"
description: "Parse the changelog and setup the release parameters."
author: "LizardByte"

inputs:
changelog_path:
description: "Path to the changelog file, relative to the GitHub workspace."
default: "CHANGELOG.md"
required: false

outputs:
changelog_changes:
description: "List of changes in the latest version."
changelog_date:
description: "Date of the latest version in the format: `yyyy.m.d`"
changelog_exists:
description: "Whether the changelog exists."
changelog_release_exists:
description: "Whether the release exists in GitHub."
changelog_url:
description: "URL to the latest version in the changelog."
changelog_version:
description: "Latest version in the changelog."
publish_stable_release:
description: "Whether to publish a stable release."
release_version:
description: "Version of the release to make."
release_build:
description: "Build number of the release to make."
release_tag:
description: "Tag of the release to make. e.g. `vYYYY.M.D-Build` or `vYYYY.M.D`"

runs:
using: "docker"
image: "Dockerfile"
Empty file added action/__init__.py
Empty file.
Loading

0 comments on commit 8f61f45

Please sign in to comment.