Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Carthage build into cli hook, use normal Jenkins mechanisms build #20

Merged
merged 9 commits into from
Apr 23, 2019

Conversation

sgtcoolguy
Copy link
Contributor

No description provided.

@build
Copy link

build commented Apr 23, 2019

Messages
📖

💾 Here are the artifacts produced:

📖

✅ All tests are passing
Nice one! All 68 tests are passing.

Dependencies with modified semantic versioning:

New dependencies added: @seadub/danger-plugin-dependencies, @seadub/danger-plugin-junit, danger, fs-extra and karma-junit-reporter.

@seadub/danger-plugin-dependencies

Author: Chris Williams

Description: Provides dependency information on dependency changes in a PR

Homepage: https://github.com/sgtcoolguy/danger-plugin-dependencies#readme

Created4 months ago
Last Updated4 months ago
LicenseMIT
Maintainers1
Releases2
Direct Dependenciesdate-fns, lodash.flatten, lodash.includes, node-fetch and semver
Keywordsdanger, danger-plugin, npm, yarn and dependencies
README

danger-plugin-dependencies

npm version

Provides dependency information on dependency changes in a PR

Usage

Install:

npm install @seadub/danger-plugin-dependencies --save-dev
# or
yarn add @seadub/danger-plugin-dependencies --dev

At a glance:

// dangerfile.js
import dependencies from '@seadub/danger-plugin-dependencies'

schedule(dependencies())

Provides 4 separate rules:

  • checkForRelease - Provides a 🎉 when there's a package version bump.
  • checkForNewDependencies (async) - Provides npmjs.com (and yarn why, when type is "yarn") metadata about new dependencies.
  • checkForLockfileDiff - Will warn you when there are dependencies or devDependencies changes without a package-lock.json or yarn.lock change.
  • checkForTypesInDeps - Will fail the build if you add any @types/[x] to dependencies instead of devDependencies.

And exports a default function to handle all of them at once.

Note: async functions like the default one have be to schedule'd by Danger.

yarn vs npm usage

By default, the dependencies method will attempt to determine if you are using npm or yarn to manage your dependencies based on sniffing for the lockfiles on disk. If no lockfiles exist, or running on Peril it will fail without an explicitly stated manasger type in the options.

You may explicitly pass one in the options:

// dangerfile.js
import dependencies from '@seadub/danger-plugin-dependencies'

schedule(dependencies({ type: "npm" }))
// or for yarn
schedule(dependencies({ type: "yarn" }))

Private packages

If you want the plugin to find your private packages on npm, you need to provide an npm authentication token:

// dangerfile.js
import dependencies from 'danger-plugin-dependencies'

schedule(dependencies({ npmAuthToken: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' }))

Changelog

See the GitHub release history.

Contributing

See CONTRIBUTING.md.

What does this look like?

The rest of this README is the contents of what it looks like when you add this plugin to your Dangerfile:


Warnings
⚠️

New dependencies added: danger-plugin-yarn.

danger-plugin-yarn

Author: Orta Therox

Description: Provides dependency information on dependency changes in a PR

Homepage: https://github.com/orta/danger-plugin-yarn#readme

Created24 days ago
Last Updated3 minutes ago
LicenseMIT
Maintainers1
Releases14
Direct Dependenciesdate-fns, lodash.flatten, lodash.includes, node-fetch and esdoc
Keywordsdanger, danger-plugin and yarn
README # danger-plugin-yarn

Build Status
npm version
semantic-release

Provides dependency information on dependency changes in a PR

Usage

Install:

yarn add danger-plugin-yarn --dev

At a glance:

// dangerfile.js
import yarn from 'danger-plugin-yarn'

schedule(yarn())

Provides 4 separate rules:

  • checkForRelease - Provides a 🎉 when there's a package version bump.
  • checkForNewDependencies (async) - Provides npmjs.com and yarn why metadata about new dependencies.
  • checkForLockfileDiff - Will warn you when there are dependencies or devDependencies changes without a yarn.lock change.
  • checkForTypesInDeps - Will fail the build if you add any @types/[x] to dependencies instead of devDependencies.

And exports a default function to handle all of them at once.

Note: async functions like the default one have be to schedule'd by Danger.

Changelog

See the GitHub release history.

Contributing

See CONTRIBUTING.md.

yarn why danger-plugin-yarn output

  • Has been hoisted to "danger-plugin-yarn"
  • This module exists because it's specified in "devDependencies".
  • Disk size without dependencies: "80kB"
  • Disk size with unique dependencies: "3.98MB"
  • Disk size with transitive dependencies: "4.43MB"
  • Number of shared dependencies: 7

Generated by 🚫 dangerJS

@seadub/danger-plugin-junit

Author: Christopher Williams

Description: Add your Junit XML test failures to Danger

Homepage: https://github.com/sgtcoolguy/danger-plugin-junit#readme

Created5 months ago
Last Updated8 days ago
LicenseMIT
Maintainers1
Releases4
Direct Dependenciesfs-extra, glob and xmldom
Keywordsdanger, danger-plugin and junit
README

danger-plugin-junit

Build Status
npm version

Add your Junit XML test failures to Danger

Usage

Install:

npm install danger-plugin-junit --save-dev
# or
yarn add danger-plugin-junit --dev

At a glance:

// dangerfile.js
import junit from 'danger-plugin-junit'

async function main() {
	await junit({ pathToReport: './build/reports/**/TESTS*.xml' })
}

main()
	.then(() => process.exit(0))
	.catch(err => {
		fail(err.toString());
		process.exit(1);
	});

The default pathToReport value is './build/reports/**/TESTS*.xml'
The value is a glob string to gather up test result files.

This plugin will only report test failures and errors. If any tests fail, it will report a single fail() message and record a table of the failed tests using markdown().

An example of what is produced is below:

Changelog

See the GitHub release history.

Contributing

See CONTRIBUTING.md.

danger

Author: Orta Therox

Description: Unit tests for Team Culture

Homepage: https://github.com/danger/danger-js#readme

Createdalmost 3 years ago
Last Updated4 days ago
LicenseMIT
Maintainers3
Releases241
Direct Dependencies@babel/polyfill, @octokit/rest, chalk, commander, debug, get-stdin, http-proxy-agent, https-proxy-agent, hyperlinker, jsome, json5, jsonpointer, jsonwebtoken, lodash.find, lodash.includes, lodash.isobject, lodash.keys, lodash.mapvalues, lodash.memoize, memfs-or-file-map-to-github-branch, micromatch, node-cleanup, node-fetch, override-require, p-limit, parse-diff, parse-git-config, parse-github-url, parse-link-header, pinpoint, readline-sync, require-from-string, rfc6902 and supports-hyperlinks
Keywordsdanger and ci
README


Formalize your Pull Request etiquette.

What is Danger JS?VisionHelping OutPlugin Development

What is Danger JS?

Danger runs after your CI, automating your team's conventions surrounding code review.

This provides another logical step in your process, through which Danger can help lint your rote tasks in daily code
review.

You can use Danger to codify your teams norms, leaving humans to think about harder problems.

Danger JS works with GitHub or BitBucket Server for code review, then with: Travis CI, Circle CI, GitHub Actions,
Semaphore, Jenkins, Docker Cloud, Bitrise, surf-build, Codeship, Drone, Buildkite, Nevercode, buddybuild, TeamCity,
Visual Studio Team Services, Screwdriver, Concourse, Netlify, CodeBuild or Codefresh.

npm
Build Status
Build Status
Join the community on Spectrum

For example?

You can:

  • Enforce CHANGELOGs
  • Enforce links to Trello/JIRA in PR/MR bodies
  • Enforce using descriptive labels
  • Look out for common anti-patterns
  • Highlight interesting build artifacts
  • Give warnings when specific files change

Danger provides the glue to let you build out the rules specific to your team's culture, offering useful metadata and
a comprehensive plugin system to share common issues.

Getting Started

Alright. So, actually, you may be in the wrong place. From here on in, this README is going to be for people who are
interested in working on and improving on Danger JS.

We keep all of the end-user documentation at http://danger.systems/js.

Some quick links to get you started:

This thing is broken, I should help improve it!

Awesommmmee. Everything you need is down below. You can also refer to CONTRIBUTING file where you'll
find the same information listed below.

git clone https://github.com/danger/danger-js.git
cd danger-js

# if you don't have yarn installed
npm install -g yarn

yarn install

You can then verify your install by running the tests, and the linters:

yarn test
yarn lint

The fixers for both tslint and prettier will be applied when you commit, and on a push your code will be verified that
it compiles.

You can run your dev copy of danger against a PR by running:

yarn build; node --inspect distribution/source/commands/danger-pr.js https://github.com/danger/danger-js/pull/817

How does Danger JS work?

Check the architecture doc.

What is the TODO?

Check the issues, I try and keep my short term perspective there. Long term is in the VISION.md.

Releasing a new version of Danger

Following this commit as a model:

  • Checkout the master branch. Ensure your working tree is clean, and make sure you have the latest changes by running
    git pull.
  • Publish - npm run release -- [major/patch/minor] --non-interactive.

🚢

License, Contributor's Guidelines and Code of Conduct

We try to keep as much discussion as possible in GitHub issues, but also have a pretty inactive Slack --- if you'd like
an invite, ping @Orta a DM on Twitter with your email. It's mostly interesting if you want
to stay on top of Danger without all the emails from GitHub.

This project is open source under the MIT license, which means you have full access to the source code and can modify
it to fit your own needs.

This project subscribes to the Moya Contributors Guidelines which TLDR: means
we give out push access easily and often.

Contributors subscribe to the Contributor Code of Conduct based on
the Contributor Covenant version 1.3.0.

fs-extra

Author: JP Richardson

Description: fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.

Homepage: https://github.com/jprichardson/node-fs-extra

Createdover 7 years ago
Last Updated4 months ago
LicenseMIT
Maintainers3
Releases83
Direct Dependenciesgraceful-fs, jsonfile and universalify
Keywordsfs, file, file system, copy, directory, extra, mkdirp, mkdir, mkdirs, recursive, json, read, write, extra, delete, remove, touch, create, text, output and move
README

Node.js: fs-extra

fs-extra adds file system methods that aren't included in the native fs module and adds promise support to the fs methods. It also uses graceful-fs to prevent EMFILE errors. It should be a drop in replacement for fs.

npm Package
License
build status
windows Build status
downloads per month
Coverage Status
JavaScript Style Guide

Why?

I got tired of including mkdirp, rimraf, and ncp in most of my projects.

Installation

npm install --save fs-extra

Usage

fs-extra is a drop in replacement for native fs. All methods in fs are attached to fs-extra. All fs methods return promises if the callback isn't passed.

You don't ever need to include the original fs module again:

const fs = require('fs') // this is no longer necessary

you can now do this:

const fs = require('fs-extra')

or if you prefer to make it clear that you're using fs-extra and not fs, you may want
to name your fs variable fse like so:

const fse = require('fs-extra')

you can also keep both, but it's redundant:

const fs = require('fs')
const fse = require('fs-extra')

Sync vs Async vs Async/Await

Most methods are async by default. All async methods will return a promise if the callback isn't passed.

Sync methods on the other hand will throw if an error occurs.

Also Async/Await will throw an error if one occurs.

Example:

const fs = require('fs-extra')

// Async with promises:
fs.copy('/tmp/myfile', '/tmp/mynewfile')
  .then(() => console.log('success!'))
  .catch(err => console.error(err))

// Async with callbacks:
fs.copy('/tmp/myfile', '/tmp/mynewfile', err => {
  if (err) return console.error(err)
  console.log('success!')
})

// Sync:
try {
  fs.copySync('/tmp/myfile', '/tmp/mynewfile')
  console.log('success!')
} catch (err) {
  console.error(err)
}

// Async/Await:
async function copyFiles () {
  try {
    await fs.copy('/tmp/myfile', '/tmp/mynewfile')
    console.log('success!')
  } catch (err) {
    console.error(err)
  }
}

copyFiles()

Methods

Async

Sync

NOTE: You can still use the native Node.js methods. They are promisified and copied over to fs-extra. See notes on fs.read() & fs.write()

What happened to walk() and walkSync()?

They were removed from fs-extra in v2.0.0. If you need the functionality, walk and walkSync are available as separate packages, klaw and klaw-sync.

Third Party

TypeScript

If you like TypeScript, you can use fs-extra with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra

File / Directory Watching

If you want to watch for changes to files or directories, then you should use chokidar.

Obtain Filesystem (Devices, Partitions) Information

fs-filesystem allows you to read the state of the filesystem of the host on which it is run. It returns information about both the devices and the partitions (volumes) of the system.

Misc.

Hacking on fs-extra

Wanna hack on fs-extra? Great! Your help is needed! fs-extra is one of the most depended upon Node.js packages. This project
uses JavaScript Standard Style - if the name or style choices bother you,
you're gonna have to get over it :) If standard is good enough for npm, it's good enough for fs-extra.

js-standard-style

What's needed?

  • First, take a look at existing issues. Those are probably going to be where the priority lies.
  • More tests for edge cases. Specifically on different platforms. There can never be enough tests.
  • Improve test coverage. See coveralls output for more info.

Note: If you make any big changes, you should definitely file an issue for discussion first.

Running the Test Suite

fs-extra contains hundreds of tests.

  • npm run lint: runs the linter (standard)
  • npm run unit: runs the unit tests
  • npm test: runs both the linter and the tests

Windows

If you run the tests on the Windows and receive a lot of symbolic link EPERM permission errors, it's
because on Windows you need elevated privilege to create symbolic links. You can add this to your Windows's
account by following the instructions here: http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7
However, I didn't have much luck doing this.

Since I develop on Mac OS X, I use VMWare Fusion for Windows testing. I create a shared folder that I map to a drive on Windows.
I open the Node.js command prompt and run as Administrator. I then map the network drive running the following command:

net use z: "\\vmware-host\Shared Folders"

I can then navigate to my fs-extra directory and run the tests.

Naming

I put a lot of thought into the naming of these functions. Inspired by @coolaj86's request. So he deserves much of the credit for raising the issue. See discussion(s) here:

First, I believe that in as many cases as possible, the Node.js naming schemes should be chosen. However, there are problems with the Node.js own naming schemes.

For example, fs.readFile() and fs.readdir(): the F is capitalized in File and the d is not capitalized in dir. Perhaps a bit pedantic, but they should still be consistent. Also, Node.js has chosen a lot of POSIX naming schemes, which I believe is great. See: fs.mkdir(), fs.rmdir(), fs.chown(), etc.

We have a dilemma though. How do you consistently name methods that perform the following POSIX commands: cp, cp -r, mkdir -p, and rm -rf?

My perspective: when in doubt, err on the side of simplicity. A directory is just a hierarchical grouping of directories and files. Consider that for a moment. So when you want to copy it or remove it, in most cases you'll want to copy or remove all of its contents. When you want to create a directory, if the directory that it's suppose to be contained in does not exist, then in most cases you'll want to create that too.

So, if you want to remove a file or a directory regardless of whether it has contents, just call fs.remove(path). If you want to copy a file or a directory whether it has contents, just call fs.copy(source, destination). If you want to create a directory regardless of whether its parent directories exist, just call fs.mkdirs(path) or fs.mkdirp(path).

Credit

fs-extra wouldn't be possible without using the modules from the following authors:

License

Licensed under MIT

Copyright (c) 2011-2017 JP Richardson

karma-junit-reporter

Author: Vojta Jina

Description: A Karma plugin. Report results in junit xml format.

Homepage: https://github.com/karma-runner/karma-junit-reporter#readme

Createdabout 6 years ago
Last Updatedover 1 year ago
LicenseMIT
Maintainers3
Releases21
Direct Dependenciespath-is-absolute and xmlbuilder
Keywordsjunit, karma-plugin and karma-reporter
README

karma-junit-reporter

js-standard-style
npm version npm downloads

Build Status Dependency Status devDependency Status

Reporter for the JUnit XML format.

Installation

The easiest way is to keep karma-junit-reporter as a devDependency in your package.json. Just run

npm install karma-junit-reporter --save-dev

to let npm automatically add it there.

Configuration

// karma.conf.js
module.exports = function(config) {
  config.set({
    reporters: ['progress', 'junit'],

    // the default configuration
    junitReporter: {
      outputDir: '', // results will be saved as $outputDir/$browserName.xml
      outputFile: undefined, // if included, results will be saved as $outputDir/$browserName/$outputFile
      suite: '', // suite will become the package name attribute in xml testsuite element
      useBrowserName: true, // add browser name to report and classes names
      nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
      classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
      properties: {} // key value pair of properties to add to the <properties> section of the report
    }
  });
};

You can pass list of reporters as a CLI argument too:

karma start --reporters junit,dots

Produce test result with schema acceptable in sonar

To make this possible, it's required to make the classnames of each tests to match its file name.

For Example:

describe('analytics.AnalyticsModule_test', function(){

    var analytics;
    beforeEach(module('ECApp'));
    beforeEach(module('angularytics'));
    beforeEach(module('AnalyticsModule'));
...

should have a file name AnalyticsModule_test.js

This will produce test result with schema acceptable in sonar.

Grunt file reporters property example:

reporters: ['junit', 'coverage', 'progress'],
junitReporter: {
    outputDir: $junitResults,
    suite: 'models'
},
coverageReporter: {
    type: 'lcov',
    dir: $coverageOutputDir,
    subdir: '.'
},
preprocessors: {
    'src/main/webapp/public/js/ec3.3/**/*.js': 'coverage',
    'src/main/webapp/public/js/ec3/**/*.js': 'coverage'
},
plugins: [
    'karma-jasmine',
    'karma-phantomjs-launcher',
    'ec-karma-junit-reporter23',
    'karma-coverage'
]

Sonar property example:

sonar.projectName=js
sonar.sources=site-main-php/src/main/webapp/public/js
sonar.projectBaseDir=.
sonar.exclusions=site-main-php/src/main/webapp/public/js/lib/*.js,site-main-php/src/main/webapp/public/js/tests/**/*.php,site-main-php/src/main/webapp/public/js/tests/**/*.js,site-main-php/src/main/webapp/public/js/ec3.3/vendor/**
sonar.javascript.lcov.reportPath=site-main-php/target/coverage/lcov.info
sonar.javascript.jstestdriver.reportsPath=site-main-php/target/surefire-reports/
sonar.tests=site-main-php/src/main/webapp/public/js/tests

Example junit xml report:

<?xml version="1.0"?>
<testsuite name="PhantomJS 1.9.8 (Linux)" package="models" timestamp="2015-03-10T13:59:23" id="0" hostname="admin" tests="629" errors="0" failures="0" time="11.452">
  <properties>
    <property name="browser.fullName" value="Mozilla/5.0 (Unknown; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34"/>
  </properties>
 <testcase name="(C.2) Checks if an empty object is returned when error 404 is encountered" time="0.01" classname="PhantomJS_1_9_8_(Linux).models.AnalyticsModule_test"/>
 <testcase name="(C.3) Checks if an empty array is returned when error 405 is encountered" time="0.013" classname="PhantomJS_1_9_8_(Linux).models.AnalyticsModule_test"/>
</testsuite>
...

For more information on Karma see the homepage.

Generated by 🚫 dangerJS against e9548b9

@sgtcoolguy sgtcoolguy merged commit fbefb4f into tidev:master Apr 23, 2019
@sgtcoolguy sgtcoolguy deleted the hook branch April 23, 2019 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants