-
Notifications
You must be signed in to change notification settings - Fork 42
/
.gitlab-ci.yml
123 lines (111 loc) · 3.98 KB
/
.gitlab-ci.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
113
114
115
116
117
118
119
120
121
122
123
# This file is a template, and might need editing before it works on your project.
# This template uses the java:8 docker image because there isn't any
# official Gradle image at this moment
#
# This is the Gradle build system for JVM applications
# https://gradle.org/
# https://github.com/gradle/gradle
image: java:8
variables:
VERSION: "0.1.7"
# Make the gradle wrapper executable. This essentially downloads a copy of
# Gradle to build the project with.
# https://docs.gradle.org/current/userguide/gradle_wrapper.html
# It is expected that any modern gradle project has a wrapper
before_script:
- chmod +x gradlew
# We redirect the gradle user home using -g so that it caches the
# wrapper and dependencies.
# https://docs.gradle.org/current/userguide/gradle_command_line.html
#
# Unfortunately it also caches the build output so
# cleaning removes reminants of any cached builds.
# The assemble task actually builds the project.
# If it fails here, the tests can't run.
build:
stage: build
script:
- ./gradlew -g /cache/.gradle clean assemble
allow_failure: false
artifacts:
paths:
- gradle/build/artifacts/mbeddr-arduino/
expire_in: 1 week
build lib with GCC 4.9:
stage: build
image: coolya/gcc-avr:4.9
artifacts:
paths:
- lib/build/
expire_in: 1 week
script:
- cd lib
- make
build lib with GCC 5.4:
stage: build
image: coolya/gcc-avr:5.4
artifacts:
paths:
- lib/build/
expire_in: 1 week
script:
- cd lib
- make
# Use the generated build output to run the tests.
test:
stage: test
script:
- ./gradlew -g /cache./gradle check
deploy github release:
stage: deploy
before_script:
# Install ssh-agent if not already installed, it is required by Docker.
# (change apt-get to yum if you use a CentOS-based image)
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client zip -y )'
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# For Docker builds disable host key checking. Be aware that by adding that
# you are suspectible to man-in-the-middle attacks.
# WARNING: Use this only with the Docker executor, if you use it with shell
# you will overwrite your user's SSH config.
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- git remote add github https://[email protected]/coolya/mbeddr.arduino.git
after_script:
- git remote remove github
script:
- mkdir tmp
- cd tmp
- wget https://github.com/aktau/github-release/releases/download/v0.6.2/linux-amd64-github-release.tar.bz2
- tar -xjvf linux-amd64-github-release.tar.bz2
- mv bin/linux/amd64/github-release /usr/bin/
- cd ..
- rm -rf tmp/
- git tag $VERSION HEAD
- git push github HEAD:release
- git push github $VERSION
- github-release release -s $GITHUB_TOKEN -u coolya -r mbeddr.arduino -t $VERSION
- github-release upload -s $GITHUB_TOKEN -u coolya -r mbeddr.arduino -t $VERSION -f gradle/build/artifacts/mbeddr-arduino/mbeddr-arduino.zip -n mbeddr-arduino.zip
only:
- release
deploy github:
stage: deploy
before_script:
# Install ssh-agent if not already installed, it is required by Docker.
# (change apt-get to yum if you use a CentOS-based image)
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# For Docker builds disable host key checking. Be aware that by adding that
# you are suspectible to man-in-the-middle attacks.
# WARNING: Use this only with the Docker executor, if you use it with shell
# you will overwrite your user's SSH config.
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- git remote add github https://[email protected]/coolya/mbeddr.arduino.git
after_script:
- git remote remove github
only:
- master
script:
- git push github HEAD:master