-
Notifications
You must be signed in to change notification settings - Fork 2
/
Taskfile.yaml
74 lines (67 loc) · 2.12 KB
/
Taskfile.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
version: 3
vars:
BRANCH:
sh: if [ $(git rev-parse --abbrev-ref HEAD) != "main" ]; then echo $(git rev-parse --abbrev-ref HEAD); else echo main ; fi
# PRECONDITION TO CHECK IF THE VIRTUAL ENVIRONMENT IS ACTIVATED
venv-precondition: &venv
- sh: |
pip -V | grep '.venv' >/dev/null 2>&1
msg: "The pip version output does not contain .venv, Halting. Run task setup-molecule and/or source .venv/bin/activate"
tasks:
run-molecule:
preconditions: *venv
cmds:
- molecule test -s {{ .scenario }}
setup-molecule:
preconditions: *venv
cmds:
- pip install -U setuptools pip 'molecule'
- pip install molecule-docker
- pip install netaddr
- molecule --version
setup-venv:
desc: "Setup python virtual environment"
cmds:
- rm -rf ./.venv
- python3 -m venv ./.venv
- echo "Don't forget to run\nsource ./.venv/bin/activate"
branch:
desc: Create branch from main
cmds:
- git checkout main
- git branch
- git pull
- |
echo "Enter to be created (remote) branch:"
read BRANCH_NAME;
git checkout -b ${BRANCH_NAME}
git push origin ${BRANCH_NAME}
- git branch
- git branch --set-upstream-to=origin/main ${BRANCH_NAME}
commit:
desc: Commit + push code into branch
cmds:
- rm -rf dist/
- git branch --set-upstream-to=origin/{{ .BRANCH }}
- git pull
- |
echo "ENTER COMMIT MESSAGE"
read COMMIT_MESSAGE;
git add *
if [[ -n $(git status --porcelain) ]]; then
echo "committing changes"
git commit --allow-empty -a -m "$(echo ${COMMIT_MESSAGE})"
else
echo "no changes"
fi
git push origin -u {{ .BRANCH }}
pr:
desc: Create pull request into main
cmds:
- task: commit
- gh pr create -t "{{ .BRANCH }}" -b "{{ .BRANCH }} branch into main"
- sleep 20s
# - gh pr checks $(gh pr list | grep "^[^#;]" | awk '{print $1}') --watch
- gh pr merge $(gh pr list | grep "^[^#;]" | awk '{print $1}') --auto --rebase --delete-branch
- git checkout main && git pull