Skip to content

Commit

Permalink
Add templates and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
craig8 committed Oct 20, 2023
1 parent 6e59cd6 commit 622092d
Show file tree
Hide file tree
Showing 7 changed files with 405 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: unconfirmed
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Run command '...'
3. Scroll down to '...'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**System (please complete the following information):**

- `volttron-topic-watcher` version: [e.g. 0.2.1]
- Python version: [e.g. 3.8]
- OS: [Windows/Linux]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
22 changes: 22 additions & 0 deletions .github/workflows/auto-assign-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Add bugs to bugs project

on:
issues:
types:
- opened

jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
# You can target a repository in a different organization
# to the issue
project-url: https://github.com/orgs/eclipse-volttron/projects/3
# project-url: https://github.com/orgs/<orgName>/projects/<projectNumber>
# github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
github-token: ${{ secrets.AUTO_PROJECT_PAT }}
# labeled: bug, needs-triage
# label-operator: OR
70 changes: 70 additions & 0 deletions .github/workflows/code-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: CodeQL

on:
push:
branches: [main, develop, releases]
pull_request:
# The branches below must be a subset of the branches above
branches: [main, develop, releases]
schedule:
- cron: 34 10 * * 4

jobs:
analyze:
name: Analyze
runs-on: ubuntu-20.04
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [python]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
125 changes: 125 additions & 0 deletions .github/workflows/deploy-pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
---
name: Deploy Pre-Release Artifacts

on:
push:
branches:
- develop

defaults:
run:
shell: bash

env:
LANG: en_US.utf-8
LC_ALL: en_US.utf-8
PYTHON_VERSION: '3.10'

jobs:

bump_version:
if: github.ref_name != 'main'
runs-on: ubuntu-22.04
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."

#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Checkout code
uses: actions/[email protected]
with:
fetch-depth: 0

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

#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/[email protected]
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/[email protected]
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: |
poetry install --no-interaction
- name: Bump Version
run: |
# current_tag is the last tagged release in the repository. From there
# we need to remove the v from the beginning of the tag.
echo "Bump rule is prerelease"
if ! $(git tag -l "v*" = ''); then
# uses -V which is version sort to keep it monotonically increasing.
current_tag=$(git tag -l "v*" | grep --invert-match '-' | sort --reverse -V | sed -n 1p)
echo "current git tag is ${current_tag}"
current_tag=${current_tag#?}
# current_tag is now the version we want to set our poetry version so
# that we can bump the version
poetry version ${current_tag}
poetry version prerelease --no-interaction
else
# very first release. start with inputs.first-release-version
echo "First release. Setting tag as v0.0.1rc0"
current_tag=v0.0.1rc0
poetry version ${current_tag}
fi
NEW_TAG=v$(poetry version --short)
# Finally because we want to be able to use the variable in later
# steps we set a NEW_TAG environmental variable
echo "NEW_TAG=$(echo ${NEW_TAG})" >> $GITHUB_ENV
#---------------------------------------------------------------
# create build artifacts to be included as part of release
#---------------------------------------------------------------
- name: Create build artifacts
run: |
poetry build -vvv
- uses: ncipollo/[email protected]
with:
artifacts: "dist/*.gz,dist/*.whl"
artifactErrorsFailBuild: true
generateReleaseNotes: true
commit: ${{ github.ref }}
prerelease: true
tag: ${{ env.NEW_TAG }}
token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish pre-release to pypi
if: github.repository_owner == 'eclipse-volttron'
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish
65 changes: 65 additions & 0 deletions .github/workflows/make-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Make full release

on:
workflow_dispatch:
inputs:
merge-strategy:
description: 'Merge strategy and strategy options. Used only in case of merge conflicts'
required: false
default: ''
type: string
release-version:
description: 'Version number to use. If provided bump-rule will be ignored'
required: false
default: ''
type: string
bump-rule:
description: 'Bump rule for computing next release version number.'
required: false
default: 'prerelease'
type: choice
options:
- patch
- minor
- major
- prepatch
- preminor
- premajor
- prerelease
run-tests-wait:
description: 'Wait time to run test after merge to main'
required: false
default: 600
type: number
publish-to-test-pypi:
description: 'Set to true if you want to publish to https://test.pypi.org/legacy/ instead of pypi.org'
required: false
default: false
type: boolean


defaults:
run:
shell: bash

env:
LANG: en_US.utf-8
LC_ALL: en_US.utf-8
PYTHON_VERSION: '3.10'

jobs:
call-deploy-release:
permissions:
contents: write # To push a branch
pull-requests: write # To create a PR from that branch

uses: eclipse-volttron/github-tooling/.github/workflows/deploy-release.yml@main
with:
merge-strategy: ${{ inputs.merge-strategy }}
release-version: ${{ inputs.release-version }}
bump-rule: ${{ inputs.bump-rule }}
run-tests-wait: 600
publish-to-test-pypi: false
secrets:
git-token: ${{ secrets.AUTO_PROJECT_PAT }}
pypi-token: ${{ secrets.PYPI_TOKEN }}
Loading

0 comments on commit 622092d

Please sign in to comment.