Skip to content

Commit

Permalink
init for CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
alann-maulana committed Dec 18, 2019
1 parent 8eadcdc commit 5b10e9c
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
os: linux
dist: trusty
jdk: oraclejdk8
language: ruby
addons:
apt:
# Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18
sources:
- ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version
packages:
- lib32stdc++6 # https://github.com/flutter/flutter/issues/6207
- libstdc++6
- curl
cache:
directories:
- $HOME/.pub-cache
before_script:
- git clone https://github.com/flutter/flutter.git -b stable --depth 1
- export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH
install:
- gem install coveralls-lcov
script:
- flutter doctor -v
- make
after_success:
- coveralls-lcov --repo-token $COVERALLS_TOKEN coverage/lcov.info

deploy:
# validating branch master for deploying
- provider: script
skip_cleanup: true
script: bash scripts/deploy.sh && rm -rf scripts/ && pub publish -n -v
on:
branch: master
# deploy tagged to pub server
- provider: script
skip_cleanup: true
script: bash scripts/deploy.sh && rm -rf scripts/ && pub publish -f -v
on:
tags: true
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
DARTANALYZER_FLAGS=--fatal-warnings

build: lib/*dart test/*dart deps
dartanalyzer ${DARTANALYZER_FLAGS} lib/
dartfmt -n --set-exit-if-changed lib/ test/
flutter test --coverage --coverage-path ./coverage/lcov.info

deps: pubspec.yaml
flutter packages get -v

reformatting:
dartfmt -w lib/ test/

build-local: reformatting build
genhtml -o coverage coverage/lcov.info
lcov --list coverage/lcov.info
lcov --summary coverage/lcov.info
open coverage/index.html

pana:
pana -s path .

docs:
rm -rf doc
dartdoc --exclude 'dart:async,dart:collection,dart:convert,dart:core,dart:developer,dart:io,dart:isolate,dart:math,dart:typed_data,dart:ui,dart:html_common,dart:ffi,dart:html,dart:js,dart:js_util'

publish:
pub publish
16 changes: 16 additions & 0 deletions scripts/credentials.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

if [[ ! -e ~/.pub-cache/credentials.json ]]; then
mkdir -p ~/.pub-cache
touch ~/.pub-cache/credentials.json
fi

cat <<EOF > ~/.pub-cache/credentials.json
{
"accessToken":"$PUB_ACCESS_TOKEN",
"refreshToken":"$PUB_REFRESH_TOKEN",
"tokenEndpoint":"$PUB_TOKEN_ENDPOINT",
"scopes":[$PUB_SCOPES],
"expiration":$PUB_EXPIRATION
}
EOF
5 changes: 5 additions & 0 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

bash /scripts/credentials.sh
make deps
make docs

0 comments on commit 5b10e9c

Please sign in to comment.