-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.build.yml
112 lines (90 loc) · 3.37 KB
/
.build.yml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
image: alpine/edge
packages:
- wget
sources:
- https://git.sr.ht/~retzoh/google_services_wrapper
- https://git.sr.ht/~retzoh/keypass_google_drive_sync
environment:
repository_name: keypass_google_drive_sync
package_name: keypass-sync
package_folder: keypass_sync
package_path: .
secrets:
- ed37ce69-d5be-42df-9b92-41471089d431 # ~/.ssh/known_hosts
- 7331599a-5f2d-4b4f-9c92-e0a1483014e3 # ~/.ssh/.build_test_ssh_key
- 899472e5-1ec8-4211-a00b-05a0d3eaf775 # ~/.ssh/.github_deploy_ssh_key
- 781be119-2be8-4396-aae6-476c2560b07b # ~/.google_services_wrapper/token.json
tasks:
- install_conda: |
# Conda does not work out of the box on alpine. glibc needs to be
# manually installed. More details at:
# https://github.com/frol/docker-alpine-miniconda3
wget -q --no-check-certificate https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.28-r0/glibc-2.28-r0.apk
sudo apk add --allow-untrusted glibc-2.28-r0.apk
#Get & intall conda
wget -q http://repo.continuum.io/miniconda/\
Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
sh miniconda.sh -b -p $HOME/miniconda
#Store shell (conda) setup
echo 'export PATH="$HOME/miniconda/bin:$PATH"' >> ~/.shell_setup
echo '. /home/build/miniconda/etc/profile.d/conda.sh' >> ~/.shell_setup
- setup_project_conda: |
#Load the shell (conda) setup
. ~/.shell_setup
conda config --add channels conda-forge
conda update -y -q --all
##For one single package:
##Create an environment, install project dependencies in it
#cd $repository_name/$package_path; conda env create -q
#For multiple packages:
#Create & activate a work environment (with name package_name)
conda create -q -n $package_name
conda activate $package_name
#
#Install one package's dependencies into the work environment
cd google_services_wrapper
conda env update -q -n $package_name
pip install .
cd ..
cd $repository_name/$package_path
conda env update -q -n $package_name
- setup_project_pip: |
. ~/.shell_setup
conda activate $package_name
# Install package & it's pip dependencies
cd $repository_name/$package_path
pip install -q .
- check_dependencies: |
. ~/.shell_setup
conda activate $package_name
conda update --all --dry-run
pip list -o
- integration_test: |
. ~/.shell_setup
conda activate $package_name
# Run the tests
cd $repository_name/$package_path
pytest --cov=$package_folder tests/
- run_project: |
. ~/.shell_setup
conda activate $package_name
# Run the project
cd $repository_name/$package_path
python src/$package_folder/__init__.py
- deploy_master_github: |
ln -sf ~/.ssh/.build_test_ssh_key ~/.ssh/id_rsa
cd $repository_name
git remote set-url origin [email protected]:~retzoh/keypass_google_drive_sync
lines=`git diff --stat origin/master..HEAD | wc -l`
if [ $lines -eq 0 ]
then
echo "pushing to github"
git config --global user.email "~retzoh/[email protected]"
git config --global user.name "Deploy"
ln -sf ~/.ssh/.github_deploy_ssh_key ~/.ssh/id_rsa
git checkout -B master -t origin/master
git remote set-url origin [email protected]:Retzoh/keypass_google_drive_sync.git
git push --set-upstream origin master
else
echo "Aborting github deployment: HEAD is dirty compared to master."
fi