forked from bigbluebutton/bbb-lti-broker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
69 lines (68 loc) · 2.19 KB
/
.travis.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
# Modifiers through environment variables in TravisCI
#
# For pushing the image to DockerHub add:
# DOCKER_REPO=your-username/your-repo (by default the Git Repo Slug is assigned. e.g. bigbluebutton/bbb-lti-broker)
# DOCKER_USERNAME=your-username
# DOCKER_PASSWORD=your-password
#
# For bypassing tests add:
# TEST_IGNORE=true
#
# For bypassing build add:
# BUILD_IGNORE=true
#
# For building docker images for all branches add:
# BUILD_ALL=true (by default only docker images for tags and master branch are built)
sudo: required
language: ruby
rvm:
- 2.7.1
cache:
bundler: true
directories:
- tmp/cache/assets/test/sprockets
services:
- postgresql
- docker
env:
global:
- COMMIT_SHORT_SHA=${TRAVIS_COMMIT::8}
- BUILD_NUMBER="${TRAVIS_TAG:-${TRAVIS_BRANCH}-${COMMIT_SHORT_SHA}}"
- DOCKER_REPO="${DOCKER_REPO:-${TRAVIS_REPO_SLUG}}"
jobs:
include:
- stage: test
name: rubocop
script:
- bundle exec rubocop
if: env(TEST_IGNORE) IS NOT present
- stage: test
name: test
before_script:
- bundle install
before_script:
- bundle exec rake db:create
- bundle exec rake db:migrate
script:
- export
- bundle exec rails test
if: env(TEST_IGNORE) IS NOT present
# This build is only triggered when building from a branch.
- stage: build
name: build branch
script:
- docker build -t $DOCKER_REPO:$TRAVIS_BRANCH --build-arg BUILD_NUMBER="$TRAVIS_BRANCH ($(expr substr $TRAVIS_COMMIT 1 7))" .
after_success:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD docker.io
- docker push $DOCKER_REPO
if: env(BUILD_IGNORE) IS NOT present AND env(TRAVIS_PULL_REQUEST) IS NOT present AND branch = master OR tag IS blank AND env(BUILD_ALL) IS present
# This build is only triggered when building from a tag.
- stage: build
name: build release
script:
- docker build -t $DOCKER_REPO:$TRAVIS_TAG --build-arg BUILD_NUMBER=$TRAVIS_TAG .
after_success:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD docker.io
- docker tag $DOCKER_REPO:$TRAVIS_TAG $DOCKER_REPO:latest
- docker push $DOCKER_REPO
if: env(BUILD_IGNORE) IS NOT present AND tag IS NOT blank