Skip to content

Commit e869c7d

Browse files
Merge pull request #5 from KarmaComputing/4-issue-templates
wip #4 issue templates
2 parents c3e0968 + 0866e63 commit e869c7d

8 files changed

Lines changed: 344 additions & 0 deletions

File tree

.autorc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"plugins": [
3+
"git-tag",
4+
"all-contributors",
5+
"first-time-contributor",
6+
"released"
7+
],
8+
"owner": "GITHUB_OWNER",
9+
"repo": "REPO_NAME",
10+
"name": "GITHUB_OWNER",
11+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ main ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ main ]
20+
schedule:
21+
- cron: '34 8 * * 1'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'python' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v2
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 https://git.io/JvXDl
60+
61+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62+
# and modify them (or add more) to build your code if your project
63+
# uses a compiled language
64+
65+
#- run: |
66+
# make bootstrap
67+
# make release
68+
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@v2
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: delete merged pr preview
2+
on:
3+
pull_request:
4+
types: [closed]
5+
6+
jobs:
7+
Delete:
8+
environment: production
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: delete dokku app
12+
env:
13+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
14+
DOKKU_HOST: ${{ secrets.DOKKU_HOST }}
15+
run: |
16+
set -x
17+
mkdir -p ~/.ssh
18+
ssh-keyscan ${{ secrets.DOKKU_HOST }}>> ~/.ssh/known_hosts
19+
eval `ssh-agent -s`
20+
ssh-add - <<< "$SSH_PRIVATE_KEY"
21+
echo deleting dokku app ${{ github.head_ref }}
22+
ssh dokku@$DOKKU_HOST -C "dokku -- --force apps:destroy ${{ github.head_ref }}"

.github/workflows/deploy.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Deploy
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
Deploy:
10+
environment: production
11+
runs-on: ubuntu-latest
12+
steps:
13+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
14+
- run: echo "🐧 This job is now running on a ${{ runner.os }} server."
15+
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
16+
- name: Check out repository code
17+
uses: actions/checkout@v3
18+
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
19+
- name: List files in the repository
20+
run: |
21+
ls ${{ github.workspace }}
22+
- name: Deploy
23+
run: |
24+
set -x
25+
mkdir -p ~/.ssh
26+
ssh-keyscan ${{ secrets.DOKKU_HOST }}>> ~/.ssh/known_hosts
27+
eval `ssh-agent -s`
28+
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY}}"
29+
ssh dokku@${{ secrets.DOKKU_HOST }} -C dokku builder:set containerhosting build-dir src
30+
ssh dokku@${{ secrets.DOKKU_HOST }} -C "dokku builder-dockerfile:set containerhosting dockerfile-path Dockerfile"
31+
ssh dokku@${{ secrets.DOKKU_HOST }} -C "dokku git:sync --build minimalcd" https://github.com/GITHUB_OWNER/containerhosting.git main
32+

.github/workflows/pr-preview.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
# When a push is made to a branch, deploy an instance of the app using
3+
# that branch.
4+
# The deployed url will be <pr-number>-<app-name>.<domain>
5+
6+
name: PR Preview
7+
on:
8+
pull_request
9+
jobs:
10+
pr_preview:
11+
runs-on: ubuntu-20.04
12+
timeout-minutes: 60
13+
environment:
14+
name: Testing
15+
url: ${{ steps.set_subdomain.outputs.preview_url }}
16+
concurrency:
17+
group: ${{ github.ref }}
18+
cancel-in-progress: true
19+
steps:
20+
21+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
22+
- run: echo "🐧 This job is now running on a ${{ runner.os }} server."
23+
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
24+
- name: Check out repository code
25+
uses: actions/checkout@v3
26+
with:
27+
fetch-depth: 0
28+
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
29+
- name: List files in the repository
30+
run: |
31+
ls ${{ github.workspace }}
32+
33+
34+
- name: Prepare runner with ssh keys
35+
env:
36+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
37+
DOKKU_HOST: ${{ secrets.DOKKU_HOST }}
38+
run: |
39+
set -x
40+
mkdir -p ~/.ssh
41+
eval `ssh-agent -s`
42+
ssh-add - <<< "$SSH_PRIVATE_KEY"
43+
ssh-keyscan $DOKKU_HOST >> ~/.ssh/known_hosts
44+
45+
- name: Set subdomain (ensure is lowercase for dokku)
46+
id: set_subdomain
47+
run: |
48+
set -x
49+
echo SUBDOMAIN=`echo "${{ github.head_ref }}" | tr '[:upper:]' '[:lower:]' | cut -c -60` >> $GITHUB_ENV
50+
echo "::set-output name=preview_url::http://${{ github.head_ref }}.${{ secrets.DOKKU_DOMAIN }}"
51+
52+
- name: Create dokku app for pr branch if dosent already exist using dokku apps:create
53+
env:
54+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
55+
DOKKU_HOST: ${{ secrets.DOKKU_HOST }}
56+
DOKKU_DOMAIN: ${{ secrets.DOKKU_DOMAIN }}
57+
run: |
58+
set -x
59+
echo The PR was raised by: ${{ github.event.pull_request.user.login }}
60+
eval `ssh-agent -s`
61+
ssh-add - <<< "$SSH_PRIVATE_KEY"
62+
ssh dokku@$DOKKU_HOST -C "dokku apps:unlock --force ${{ env.SUBDOMAIN }}" | true
63+
echo deleting dokku app ${{ github.head_ref }}
64+
ssh dokku@$DOKKU_HOST -C "dokku -- --force apps:destroy ${{ env.SUBDOMAIN }}" | true
65+
echo Creating dokku app ${{ github.head_ref }}
66+
ssh dokku@$DOKKU_HOST -C "dokku apps:create ${{ env.SUBDOMAIN }}" | true
67+
ssh dokku@$DOKKU_HOST -C dokku builder:set ${{ env.SUBDOMAIN }} build-dir src
68+
ssh dokku@$DOKKU_HOST -C "dokku builder-dockerfile:set ${{ env.SUBDOMAIN }} dockerfile-path Dockerfile"
69+
ssh dokku@$DOKKU_HOST -C "dokku git:initialize ${{ env.SUBDOMAIN }}"
70+
ssh dokku@$DOKKU_HOST -C "dokku git:set ${{ env.SUBDOMAIN }} deploy-branch ${{ github.head_ref }}"
71+
72+
- name: Deploy branch ${{ github.head_ref }} to dokku
73+
uses: idoberko2/dokku-deploy-github-action@v1
74+
with:
75+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
76+
dokku-host: ${{ secrets.DOKKU_HOST }}
77+
app-name: ${{ env.SUBDOMAIN }}
78+
git-push-flags: '--force'
79+
remote-branch: ${{ github.head_ref }}
80+
81+
- name: Click to see your PR web address
82+
env:
83+
DOKKU_DOMAIN: ${{ secrets.DOKKU_DOMAIN }}
84+
run: |
85+
echo Visit your pr here: ${{ steps.set_subdomain.outputs.preview_url }}
86+
87+
- name: 'Comment PR with web address of application live preview'
88+
env:
89+
DOKKU_DOMAIN: ${{ secrets.DOKKU_DOMAIN }}
90+
uses: actions/github-script@v3
91+
if: github.event_name == 'pull_request'
92+
with:
93+
script: |
94+
github.issues.createComment({
95+
issue_number: context.issue.number,
96+
owner: context.repo.owner,
97+
repo: context.repo.repo,
98+
body: "🙌 Live preview is here: ${{ steps.set_subdomain.outputs.preview_url }}"
99+
})
100+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish_Container
2+
3+
on:
4+
push:
5+
# Publish `master` as Docker `latest` image.
6+
branches:
7+
- main
8+
9+
# Publish `v1.2.3` tags as releases.
10+
tags:
11+
- v*
12+
paths-ignore:
13+
- '**/README.md'
14+
- '**/TESTING.md'
15+
# Run tests for any PRs.
16+
pull_request:
17+
18+
env:
19+
IMAGE_NAME: ${{ github.event.repository.name }}
20+
DOCKER_BUILDKIT: 1
21+
22+
jobs:
23+
# Push image to GitHub Packages.
24+
push:
25+
runs-on: ubuntu-latest
26+
if: github.event_name == 'push'
27+
28+
permissions:
29+
contents: read
30+
packages: write
31+
32+
steps:
33+
- uses: actions/checkout@v2
34+
35+
- name: Build image
36+
run: cd src && docker build . --file Dockerfile --tag $IMAGE_NAME
37+
38+
- name: Log into registry
39+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
40+
41+
- name: Push image
42+
run: |
43+
IMAGE_ID=ghcr.io/${{ github.repository }}/$IMAGE_NAME
44+
45+
# Change all uppercase to lowercase
46+
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
47+
48+
# Strip git ref prefix from version
49+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
50+
51+
# Strip "v" prefix from tag name
52+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
53+
54+
# Use Docker `latest` tag convention
55+
[ "$VERSION" == "master" ] && VERSION=latest
56+
57+
echo IMAGE_ID=$IMAGE_ID
58+
echo VERSION=$VERSION
59+
60+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
61+
docker push $IMAGE_ID:$VERSION

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Cut Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
release:
11+
runs-on: ubuntu-latest
12+
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Prepare repository
17+
run: git fetch --unshallow --tags
18+
19+
- name: Display the environment variables and their values
20+
run: |
21+
curl -L -o /tmp/auto.gz https://github.com/intuit/auto/releases/download/v10.32.1/auto-linux.gz
22+
gzip -d /tmp/auto.gz
23+
chmod +x /tmp/auto
24+
- name: Create Release
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: |
28+
npx /tmp/auto shipit

0 commit comments

Comments
 (0)