Skip to content

Commit 7fd63a6

Browse files
authored
Initial commit
0 parents  commit 7fd63a6

34 files changed

+1226
-0
lines changed

.github/FUNDING.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# These are supported funding model platforms
2+
3+
github: [rochacbruno]
4+
patreon: # Replace with a single Patreon username
5+
open_collective: # Replace with a single Open Collective username
6+
ko_fi: # Replace with a single Ko-fi username
7+
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
liberapay: # Replace with a single Liberapay username
10+
issuehunt: # Replace with a single IssueHunt username
11+
otechie: # Replace with a single Otechie username
12+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug, help wanted
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Desktop (please complete the following information):**
27+
- OS: [e.g. iOS]
28+
- Version [e.g. 22]
29+
30+
**Additional context**
31+
Add any other context about the problem here.
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: enhancement, question
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.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### Summary :memo:
2+
_Write an overview about it._
3+
4+
### Details
5+
_Describe more what you did on changes._
6+
1. (...)
7+
2. (...)
8+
9+
### Bugfixes :bug: (delete if dind't have any)
10+
-
11+
12+
### Checks
13+
- [ ] Closed #798
14+
- [ ] Tested Changes
15+
- [ ] Stakeholder Approval

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/init.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env bash
2+
overwrite_template_dir=0
3+
4+
while getopts t:o flag
5+
do
6+
case "${flag}" in
7+
t) template=${OPTARG};;
8+
o) overwrite_template_dir=1;;
9+
esac
10+
done
11+
12+
if [ -z "${template}" ]; then
13+
echo "Available templates: flask"
14+
read -p "Enter template name: " template
15+
fi
16+
17+
repo_urlname=$(basename -s .git `git config --get remote.origin.url`)
18+
repo_name=$(basename -s .git `git config --get remote.origin.url` | tr '-' '_' | tr '[:upper:]' '[:lower:]')
19+
repo_owner=$(git config --get remote.origin.url | awk -F ':' '{print $2}' | awk -F '/' '{print $1}')
20+
echo "Repo name: ${repo_name}"
21+
echo "Repo owner: ${repo_owner}"
22+
echo "Repo urlname: ${repo_urlname}"
23+
24+
if [ -f ".github/workflows/rename_project.yml" ]; then
25+
.github/rename_project.sh -a "${repo_owner}" -n "${repo_name}" -u "${repo_urlname}" -d "Awesome ${repo_name} created by ${repo_owner}"
26+
fi
27+
28+
function download_template {
29+
rm -rf "${template_dir}"
30+
mkdir -p .github/templates
31+
git clone "${template_url}" "${template_dir}"
32+
}
33+
34+
echo "Using template:${template}"
35+
template_url="https://github.com/rochacbruno/${template}-project-template"
36+
template_dir=".github/templates/${template}"
37+
if [ -d "${template_dir}" ]; then
38+
# Template directory already exists
39+
if [ "${overwrite_template_dir}" -eq 1 ]; then
40+
# user passed -o flag, delete and re-download
41+
echo "Overwriting ${template_dir}"
42+
download_template
43+
else
44+
# Ask user if they want to overwrite
45+
echo "Directory ${template_dir} already exists."
46+
read -p "Do you want to overwrite it? [y/N] " -n 1 -r
47+
echo
48+
if [[ $REPLY =~ ^[Yy]$ ]]; then
49+
echo "Overwriting ${template_dir}"
50+
download_template
51+
else
52+
# User decided not to overwrite
53+
echo "Using existing ${template_dir}"
54+
fi
55+
fi
56+
else
57+
# Template directory does not exist, download it
58+
echo "Downloading ${template_url}"
59+
download_template
60+
fi
61+
62+
echo "Applying ${template} template to this project"}
63+
./.github/templates/${template}/apply.sh -a "${repo_owner}" -n "${repo_name}" -u "${repo_urlname}" -d "Awesome ${repo_name} created by ${repo_owner}"
64+
65+
# echo "Removing temporary template files"
66+
# rm -rf .github/templates/${template}
67+
68+
echo "Done! review, commit and push the changes"

.github/release_message.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
previous_tag=$(git tag --sort=-creatordate | sed -n 2p)
3+
git shortlog "${previous_tag}.." | sed 's/^./ &/'

.github/rename_project.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env bash
2+
while getopts a:n:u:d: flag
3+
do
4+
case "${flag}" in
5+
a) author=${OPTARG};;
6+
n) name=${OPTARG};;
7+
u) urlname=${OPTARG};;
8+
d) description=${OPTARG};;
9+
esac
10+
done
11+
12+
echo "Author: $author";
13+
echo "Project Name: $name";
14+
echo "Project URL name: $urlname";
15+
echo "Description: $description";
16+
17+
echo "Renaming project..."
18+
19+
original_author="author_name"
20+
original_name="project_name"
21+
original_urlname="project_urlname"
22+
original_description="project_description"
23+
# for filename in $(find . -name "*.*")
24+
for filename in $(git ls-files)
25+
do
26+
sed -i "s/$original_author/$author/g" $filename
27+
sed -i "s/$original_name/$name/g" $filename
28+
sed -i "s/$original_urlname/$urlname/g" $filename
29+
sed -i "s/$original_description/$description/g" $filename
30+
echo "Renamed $filename"
31+
done
32+
33+
mv project_name $name
34+
35+
# This command runs only once on GHA!
36+
rm -rf .github/template.yml

.github/template.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
author: rochacbruno

.github/workflows/main.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: CI
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the main branch
8+
push:
9+
branches: [ main ]
10+
pull_request:
11+
branches: [ main ]
12+
13+
# Allows you to run this workflow manually from the Actions tab
14+
workflow_dispatch:
15+
16+
jobs:
17+
linter:
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python-version: [3.9]
22+
os: [ubuntu-latest]
23+
runs-on: ${{ matrix.os }}
24+
steps:
25+
- uses: actions/checkout@v3
26+
- uses: actions/setup-python@v4
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
- name: Install project
30+
run: make install
31+
- name: Run linter
32+
run: make lint
33+
34+
tests_linux:
35+
needs: linter
36+
strategy:
37+
fail-fast: false
38+
matrix:
39+
python-version: [3.9]
40+
os: [ubuntu-latest]
41+
runs-on: ${{ matrix.os }}
42+
steps:
43+
- uses: actions/checkout@v3
44+
- uses: actions/setup-python@v4
45+
with:
46+
python-version: ${{ matrix.python-version }}
47+
- name: Install project
48+
run: make install
49+
- name: Run tests
50+
run: make test
51+
- name: "Upload coverage to Codecov"
52+
uses: codecov/codecov-action@v3
53+
# with:
54+
# fail_ci_if_error: true
55+
56+
tests_mac:
57+
needs: linter
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
python-version: [3.9]
62+
os: [macos-latest]
63+
runs-on: ${{ matrix.os }}
64+
steps:
65+
- uses: actions/checkout@v3
66+
- uses: actions/setup-python@v4
67+
with:
68+
python-version: ${{ matrix.python-version }}
69+
- name: Install project
70+
run: make install
71+
- name: Run tests
72+
run: make test
73+
74+
tests_win:
75+
needs: linter
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
python-version: [3.9]
80+
os: [windows-latest]
81+
runs-on: ${{ matrix.os }}
82+
steps:
83+
- uses: actions/checkout@v3
84+
- uses: actions/setup-python@v4
85+
with:
86+
python-version: ${{ matrix.python-version }}
87+
- name: Install Pip
88+
run: pip install --user --upgrade pip
89+
- name: Install project
90+
run: pip install -e .[test]
91+
- name: run tests
92+
run: pytest -s -vvvv -l --tb=long tests

0 commit comments

Comments
 (0)