You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

98 lines
3.5 KiB

image: debian/unstable
packages:
- opam
- ocaml
- curl
environment:
deploy: fs@zapashcanon.fr
sshopts: "-o StrictHostKeyChecking=no -q"
secrets:
- ec1f49cd-38dc-41d9-89f4-c3b6ecd7bcad # ssh deploy key
- b5b0e36c-fe52-43c4-9103-0aa918ad175c # github token
- c9e55d80-7b6a-4ad4-81bd-921d2c3247b8 # dune release profile
- ff8575b8-7192-4e0c-9905-6d04142a4ec1 # git config
tasks:
- setup: |
opam init -y
opam update -y
opam install -y dune bisect_ppx odoc ocamlformat menhir js_of_ocaml js_of_ocaml-ppx irc-client irc-client-lwt
- lint-format: |
cd $GIT_REPO_NAME
eval "$(opam env)"
ocamlformat -p ocamlformat --enable-outside-detected-project --check $(find . -name '*.ml')
- build: |
cd $GIT_REPO_NAME
eval "$(opam env)"
dune build @all
- test: |
cd $GIT_REPO_NAME
eval "$(opam env)"
dune runtest
- deploy-doc: |
cd $GIT_REPO_NAME
eval "$(opam env)"
dune build @doc
doc_dst="/var/www/doc.zapashcanon.fr/$GIT_REPO_NAME/"
ssh $sshopts $deploy "mkdir -p $doc_dst"
scp $sshopts -r _build/default/_doc/_html/* $deploy:$doc_dst
- deploy-coverage: |
cd $GIT_REPO_NAME
eval "$(opam env)"
dune clean
BISECT_ENABLE=YES dune runtest --no-buffer --force > /dev/null
bisect-ppx-report html
cov_dst="/var/www/coverage.zapashcanon.fr/$GIT_REPO_NAME/"
ssh $sshopts $deploy "mkdir -p $cov_dst"
scp $sshopts -r _coverage/* $deploy:$cov_dst
- deploy-try: |
cd $GIT_REPO_NAME
eval "$(opam env)"
dune clean
dune build @all
try_dst="/var/www/trydddddml.zapashcanon.fr/"
try_src="_build/default/src/trydddddml"
scp $sshopts ${try_src}/index.html ${try_src}/trydddddml.js $deploy:$try_dst
- deploy-irc: |
cd $GIT_REPO_NAME
eval "$(opam env)"
dune clean
dune build @all
irc_dst="/home/dddddml/"
irc_src="_build/default/src/dddddmlbot"
ssh $sshopts $deploy "rm $irc_dst/dddddmlbot.exe"
scp $sshopts ${irc_src}/dddddmlbot.exe $deploy:$irc_dst
ssh $sshopts $deploy "nohup /home/dddddml/start_dddddml.sh > /dev/null &" & exit 0
- archive: |
cd $GIT_REPO_NAME
eval "$(opam env)"
dune clean
archive=${GIT_REPO_NAME}-dev.tar.xz
git archive -o $archive HEAD
arc_dst="/var/www/fs.zapashcanon.fr/archive/$GIT_REPO_NAME/"
ssh $sshopts $deploy "mkdir -p $arc_dst"
scp $sshopts $archive $deploy:$arc_dst
rm $archive
- release: |
cd $GIT_REPO_NAME
eval "$(opam env)"
[ -n "$GIT_TAG" ] || exit 0
opam install -y dune-release
dune-release distrib || true
archive=${GIT_REPO_NAME}-${GIT_TAG}.tbz
ls _build/${archive}
arc_dst="/var/www/fs.zapashcanon.fr/archive/$GIT_REPO_NAME/"
scp $sshopts _build/${archive} $deploy:$arc_dst
url="https://fs.zapashcanon.fr/archive/$GIT_REPO_NAME/$archive"
echo $url > _build/${GIT_REPO_NAME}-${GIT_TAG}.url
dune-release opam pkg
opam_file=_build/${GIT_REPO_NAME}.${GIT_TAG}/opam
line_num="$(grep -n -e 'src:' $opam_file | cut -d: -f1)"
sed -i -e "${line_num}s|^.*| src: \"${url}\"|" $opam_file
line_num=$(($line_num + 1))
sed -i -e "${line_num}d" $opam_file
sed -i -e "${line_num}d" $opam_file
cd ..
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
git clone https://github.com/Cameleo/opam-repository.git
cd $GIT_REPO_NAME
dune-release opam submit --no-auto-open -y