Skip to content

Commit

Permalink
Merge pull request #5 from KarmaComputing/4-issue-templates
Browse files Browse the repository at this point in the history
wip #4 issue templates
  • Loading branch information
chrisjsimpson authored Jul 13, 2022
2 parents c3e0968 + 0866e63 commit e869c7d
Show file tree
Hide file tree
Showing 8 changed files with 344 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .autorc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"plugins": [
"git-tag",
"all-contributors",
"first-time-contributor",
"released"
],
"owner": "GITHUB_OWNER",
"repo": "REPO_NAME",
"name": "GITHUB_OWNER",
}
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: ''
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.
70 changes: 70 additions & 0 deletions .github/workflows/codeql-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 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '34 8 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
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@v3

# 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
22 changes: 22 additions & 0 deletions .github/workflows/delete-merged-pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: delete merged pr preview
on:
pull_request:
types: [closed]

jobs:
Delete:
environment: production
runs-on: ubuntu-latest
steps:
- name: delete dokku app
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
DOKKU_HOST: ${{ secrets.DOKKU_HOST }}
run: |
set -x
mkdir -p ~/.ssh
ssh-keyscan ${{ secrets.DOKKU_HOST }}>> ~/.ssh/known_hosts
eval `ssh-agent -s`
ssh-add - <<< "$SSH_PRIVATE_KEY"
echo deleting dokku app ${{ github.head_ref }}
ssh dokku@$DOKKU_HOST -C "dokku -- --force apps:destroy ${{ github.head_ref }}"
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Deploy
on:
workflow_dispatch:
push:
branches:
- main

jobs:
Deploy:
environment: production
runs-on: ubuntu-latest
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."
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- name: Deploy
run: |
set -x
mkdir -p ~/.ssh
ssh-keyscan ${{ secrets.DOKKU_HOST }}>> ~/.ssh/known_hosts
eval `ssh-agent -s`
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY}}"
ssh dokku@${{ secrets.DOKKU_HOST }} -C dokku builder:set containerhosting build-dir src
ssh dokku@${{ secrets.DOKKU_HOST }} -C "dokku builder-dockerfile:set containerhosting dockerfile-path Dockerfile"
ssh dokku@${{ secrets.DOKKU_HOST }} -C "dokku git:sync --build minimalcd" https://github.com/GITHUB_OWNER/containerhosting.git main
100 changes: 100 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
# When a push is made to a branch, deploy an instance of the app using
# that branch.
# The deployed url will be <pr-number>-<app-name>.<domain>

name: PR Preview
on:
pull_request
jobs:
pr_preview:
runs-on: ubuntu-20.04
timeout-minutes: 60
environment:
name: Testing
url: ${{ steps.set_subdomain.outputs.preview_url }}
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
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."
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ github.workspace }}
- name: Prepare runner with ssh keys
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
DOKKU_HOST: ${{ secrets.DOKKU_HOST }}
run: |
set -x
mkdir -p ~/.ssh
eval `ssh-agent -s`
ssh-add - <<< "$SSH_PRIVATE_KEY"
ssh-keyscan $DOKKU_HOST >> ~/.ssh/known_hosts
- name: Set subdomain (ensure is lowercase for dokku)
id: set_subdomain
run: |
set -x
echo SUBDOMAIN=`echo "${{ github.head_ref }}" | tr '[:upper:]' '[:lower:]' | cut -c -60` >> $GITHUB_ENV
echo "::set-output name=preview_url::http://${{ github.head_ref }}.${{ secrets.DOKKU_DOMAIN }}"
- name: Create dokku app for pr branch if dosent already exist using dokku apps:create
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
DOKKU_HOST: ${{ secrets.DOKKU_HOST }}
DOKKU_DOMAIN: ${{ secrets.DOKKU_DOMAIN }}
run: |
set -x
echo The PR was raised by: ${{ github.event.pull_request.user.login }}
eval `ssh-agent -s`
ssh-add - <<< "$SSH_PRIVATE_KEY"
ssh dokku@$DOKKU_HOST -C "dokku apps:unlock --force ${{ env.SUBDOMAIN }}" | true
echo deleting dokku app ${{ github.head_ref }}
ssh dokku@$DOKKU_HOST -C "dokku -- --force apps:destroy ${{ env.SUBDOMAIN }}" | true
echo Creating dokku app ${{ github.head_ref }}
ssh dokku@$DOKKU_HOST -C "dokku apps:create ${{ env.SUBDOMAIN }}" | true
ssh dokku@$DOKKU_HOST -C dokku builder:set ${{ env.SUBDOMAIN }} build-dir src
ssh dokku@$DOKKU_HOST -C "dokku builder-dockerfile:set ${{ env.SUBDOMAIN }} dockerfile-path Dockerfile"
ssh dokku@$DOKKU_HOST -C "dokku git:initialize ${{ env.SUBDOMAIN }}"
ssh dokku@$DOKKU_HOST -C "dokku git:set ${{ env.SUBDOMAIN }} deploy-branch ${{ github.head_ref }}"
- name: Deploy branch ${{ github.head_ref }} to dokku
uses: idoberko2/dokku-deploy-github-action@v1
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
dokku-host: ${{ secrets.DOKKU_HOST }}
app-name: ${{ env.SUBDOMAIN }}
git-push-flags: '--force'
remote-branch: ${{ github.head_ref }}

- name: Click to see your PR web address
env:
DOKKU_DOMAIN: ${{ secrets.DOKKU_DOMAIN }}
run: |
echo Visit your pr here: ${{ steps.set_subdomain.outputs.preview_url }}
- name: 'Comment PR with web address of application live preview'
env:
DOKKU_DOMAIN: ${{ secrets.DOKKU_DOMAIN }}
uses: actions/github-script@v3
if: github.event_name == 'pull_request'
with:
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "🙌 Live preview is here: ${{ steps.set_subdomain.outputs.preview_url }}"
})
61 changes: 61 additions & 0 deletions .github/workflows/publish-container.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Publish_Container

on:
push:
# Publish `master` as Docker `latest` image.
branches:
- main

# Publish `v1.2.3` tags as releases.
tags:
- v*
paths-ignore:
- '**/README.md'
- '**/TESTING.md'
# Run tests for any PRs.
pull_request:

env:
IMAGE_NAME: ${{ github.event.repository.name }}
DOCKER_BUILDKIT: 1

jobs:
# Push image to GitHub Packages.
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2

- name: Build image
run: cd src && docker build . --file Dockerfile --tag $IMAGE_NAME

- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Cut Release

on:
push:
branches:
- main
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
steps:
- uses: actions/checkout@v2

- name: Prepare repository
run: git fetch --unshallow --tags

- name: Display the environment variables and their values
run: |
curl -L -o /tmp/auto.gz https://github.com/intuit/auto/releases/download/v10.32.1/auto-linux.gz
gzip -d /tmp/auto.gz
chmod +x /tmp/auto
- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx /tmp/auto shipit

0 comments on commit e869c7d

Please sign in to comment.