Skip to content

Commit

Permalink
build(gitignore): add node modules
Browse files Browse the repository at this point in the history
Signed-off-by: Naylin Medina <nmedina@teclib.com>
  • Loading branch information
Naylin15 committed Nov 19, 2018
1 parent 9aea94d commit 929834e
Show file tree
Hide file tree
Showing 12 changed files with 4,884 additions and 16 deletions.
55 changes: 44 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ reference:
name: Build gem
command: gem build fastlane-plugin-test_report.gemspec

deploy_develop: &deploy_develop
deploy_beta: &deploy_beta
run:
name: Deploy beta version
command: echo "deploying beta"

deploy_master: &deploy_master
release: &release
run:
name: Deploy production version
command: echo "deploying production"
name: Release
command: echo "running release"

documentation: &documentation
run:
Expand Down Expand Up @@ -94,7 +94,32 @@ jobs:
- *save_yarn_cache
- *rake_test
- *documentation

deploy_beta:
<<: *container_config
steps:
- checkout
- *restore_gem_cache
- *restore_yarn_cache
- *config_environment
- *save_gem_cache
- *save_yarn_cache
- *deploy_beta
release:
<<: *container_config
steps:
- checkout
- *restore_gem_cache
- *restore_yarn_cache
- *config_environment
- *save_gem_cache
- *save_yarn_cache
- *build_gem
# - run:
# name: Publish to RubyGems
# command: source ci/scripts/publish.sh
- run:
name: GitHub release
command: source ci/scripts/release.sh
workflows:
version: 2
build-test-deploy:
Expand All @@ -104,8 +129,9 @@ workflows:
requires:
- build
filters:
ignore:
- master
branches:
ignore:
- master
- documentation:
requires:
- test
Expand All @@ -114,17 +140,24 @@ workflows:
only:
- develop
- master
- deploy_develop:
- deploy_beta:
requires:
- build
- test
filters:
branches:
only:
- develop
- deploy_master:
- release:
requires:
- build
filters:
branches:
only:
- master
- /ˆrelease/.*/
# - deploy_master:
# requires:
# - build
# filters:
# branches:
# only:
# - master
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ fastlane/report.xml
coverage
test-results
spec/fixture

## Package

node_modules/
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,4 @@ Style/MethodCallWithArgsParentheses:
- context
- before
- after
- include
32 changes: 32 additions & 0 deletions ci/scripts/deploy_beta.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
#
# LICENSE
#
# This file is part of Teclib Fastlane Plugin Test Report.
#
# Fastlane Plugin Test Report is a subproject of Teclib'
#
# Fastlane Plugin Test Report is free software: you can redistribute
# it and/or modify it under the terms of the MIT License.
#
# Fastlane Plugin Test Report is distributed in the hope that it will
# be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the MIT license for further details.
# -------------------------------------------------------------------
# @author Naylin Medina - <nmedina@teclib.com>
# @copyright Copyright Teclib. All rights reserved.
# @license MIT https://opensource.org/licenses/MIT
# @link https://github.com/TECLIB/fastlane-plugin-test_report/
# @link https://teclib.github.io/fastlane-plugin-test_report/
# @link http://www.teclib-edition.com/en/
# -------------------------------------------------------------------
#

export CURRENT_VERSION=$(jq -r ".version" package.json)
yarn standard-version --prerelease 'rc'
export NEW_VERSION=$(jq -r ".version" package.json)
ruby ./ci/scripts/version.rb $CURRENT_VERSION $NEW_VERSION

gem build fastlane-plugin-test_report.gemspec
gem push *.gem
8 changes: 8 additions & 0 deletions ci/scripts/deploy_master.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#publish new version

export CURRENT_VERSION=$(jq -r ".version" package.json)
yarn standard-version
export NEW_VERSION=$(jq -r ".version" package.json)
ruby ./ci/scripts/version.rb $CURRENT_VERSION $NEW_VERSION
gem build fastlane-plugin-test_report.gemspec
gem push *.gem
4 changes: 2 additions & 2 deletions ci/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn

# install dependencies
bundle install --path vendor/bundle
Expand Down
83 changes: 83 additions & 0 deletions ci/scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env bash
#
# LICENSE
#
# This file is part of Teclib Fastlane Plugin Test Report.
#
# Fastlane Plugin Test Report is a subproject of Teclib'
#
# Fastlane Plugin Test Report is free software: you can redistribute
# it and/or modify it under the terms of the MIT License.
#
# Fastlane Plugin Test Report is distributed in the hope that it will
# be useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the MIT license for further details.
# -------------------------------------------------------------------
# @author Naylin Medina - <nmedina@teclib.com>
# @copyright Copyright Teclib. All rights reserved.
# @license MIT https://opensource.org/licenses/MIT
# @link https://github.com/TECLIB/fastlane-plugin-test_report/
# @link https://teclib.github.io/fastlane-plugin-test_report/
# @link http://www.teclib-edition.com/en/
# -------------------------------------------------------------------
#

GITHUB_COMMIT_MESSAGE=$(git log --format=oneline -n 1 ${CIRCLE_SHA1})

if [[ $GITHUB_COMMIT_MESSAGE != *"ci(release): generate CHANGELOG.md for version"* ]]; then

# Generate CHANGELOG.md and increment version
IS_PRERELEASE="$( cut -d '-' -f 2 <<< "$CIRCLE_BRANCH" )";

if [[ $CIRCLE_BRANCH != "$IS_PRERELEASE" ]]; then
PREFIX_PRERELEASE="$( cut -d '.' -f 1 <<< "$IS_PRERELEASE" )";
yarn standard-version -m "ci(release): generate CHANGELOG.md for version %s" --prerelease "$PREFIX_PRERELEASE"
else
yarn standard-version -m "ci(release): generate CHANGELOG.md for version %s"
fi

# Get version number from package.json
export GIT_TAG=$(jq -r ".version" package.json)
# Copy CHANGELOG.md to gh-pages branch
yarn gh-pages -- -m "ci(docs): generate CHANGELOG.md for version ${GIT_TAG}"
# Push commits and tags to origin branch
git push --follow-tags origin $CIRCLE_BRANCH
# Create release with conventional-github-releaser
yarn conventional-github-releaser -p angular -t $GITHUB_TOKEN

# get gem path
GEM=$(find ./ -name '*.gem' | head -1)

# Update release name
yarn github-release edit \
--user $CIRCLE_PROJECT_USERNAME \
--repo $CIRCLE_PROJECT_REPONAME \
--tag ${GIT_TAG} \
--name "Test Report v${GIT_TAG}" \

# Upload example code release
yarn github-release upload \
--user $CIRCLE_PROJECT_USERNAME \
--repo $CIRCLE_PROJECT_REPONAME \
--tag ${GIT_TAG} \
--name "${GIT_TAG}" \
--file ${GEM}

# Update develop branch
git fetch origin develop
git checkout develop
git clean -d -x -f
git merge $CIRCLE_BRANCH
git push origin develop

# Update master branch
git fetch origin master
git checkout master
git clean -d -x -f
git merge $CIRCLE_BRANCH
git push origin master

# Remove release branch
#git push origin :$CIRCLE_BRANCH
fi
7 changes: 7 additions & 0 deletions ci/scripts/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Dir.glob("lib/**/version.rb") do |search_file|
file = File.open("#{search_file}", "r+")
buffer = file.read.gsub("#{ARGV[0]}", "#{ARGV[1]}")
file.rewind
file.print buffer
file.close
end
6 changes: 3 additions & 3 deletions lib/fastlane/plugin/test_report/actions/test_report_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.run(params)
template = '---
layout: testReport
---
<div class="total row">
<h2 class="col-sm-18">Test Results</h2>
<h2 class="col-sm-6 text-right"><%= doc.root.attributes["tests"] %> tests</h2>
Expand All @@ -40,7 +40,7 @@ def self.run(params)
<% doc.elements.each("testsuites/testsuite/testcase") do |test| %>
<% if test.attributes["classname"] == name.attributes["name"] %>
<% if test.attributes["time"] == nil %>
<div class="test-case--failing row">
<div class="col-sm-16">
Expand Down Expand Up @@ -76,7 +76,7 @@ def self.run(params)
result = ERB.new(template).result(binding())

open(File.join(params[:output_dir], '/index.html'), 'w') do |f|
f.puts result
f.puts(result)
end
end

Expand Down
Loading

0 comments on commit 929834e

Please sign in to comment.