
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
travis-after-all
Advanced tools
Simple script that can help you execute code only once in a Travis CI build matrix
travis-after-all
is a simple script that can help you execute
code only once in a build matrix
based on whether the build has succeeded or failed.
Or to put it in another way, travis-after-all
is basically a
temporary workaround for: travis-ci/travis-ci#929.
[1] Include the command that executes the travis-after-all
script inside after_script
(or inside of a script that is included inside after_script
).
[2] Based on the exit code of travis-after-all
, run your
custom code
See examples.
--
Exit codes meaning:
0
- the job that gets this exit code is the one assigned to run the
code if the build succeeded
1
- the job that gets this exit code is the one assigned to run the
code if the build failed
other - job was not assigned to do anything
--
Terminology:
a job passed if either the tests passed or the tests failed but the job was allowed to fail
a build succeeded if all jobs passed and there is at least one job who's tests passed
a build failed if there is at least one job who didn't pass, or if all jobs passed but for all of them the tests failed
npm
Install travis-afer-all
as a devDependency
:
npm install --save-dev travis-after-all
then, in your .travis.yml
file, add:
# ...
after_script:
- |
declare exitCode;
# -- [1] -------------------------------------------------------
$(npm bin)/travis-after-all
exitCode=$?
# -- [2] -------------------------------------------------------
if [ $exitCode -eq 0 ]; then
# Here goes the code that needs to be executed if the build succeeded
fi
if [ $exitCode -eq 1 ]; then
# Here goes the code that needs to be executed if the build failed
fi
# ...
You can also run travis-afer-all
from within your node
script, e.g.:
var travisAfterAll = require('travis-after-all');
function callback(exitCode, error) {
if ( error ) {
// ...
} else {
if ( exitCode === 0 ) {
// Here goes the code that needs to be executed if the build succeeded
} else if ( exitCode === 1) {
// Here goes the code that needs to be executed if the build failed
}
}
}
travisAfterAll(callback);
In your .travis.yml
file add:
# ...
after_script:
- |
declare exitCode
# -- [1] -------------------------------------------------------
curl -sSL https://raw.githubusercontent.com/alrra/travis-after-all/1.3.0/lib/travis-after-all.js | node
exitCode=$?
# -- [2] -------------------------------------------------------
if [ $exitCode -eq 0 ]; then
# Here goes the code that needs to be executed if the build succeeded
fi
if [ $exitCode -eq 1 ]; then
# Here goes the code that needs to be executed if the build failed
fi
# ...
Note: travis-after-all
is written in JavaScript, however, since
Travis includes the Node runtime by default,
it can be use no matter what build environment
you use.
The code is available under the MIT license.
FAQs
Script that can help you execute code only once in a Travis CI build matrix
The npm package travis-after-all receives a total of 256 weekly downloads. As such, travis-after-all popularity was classified as not popular.
We found that travis-after-all demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.