initial commit of actions

This commit is contained in:
Dominik Polakovics Polakovics 2026-01-31 18:56:04 +01:00
commit 949ece5785
44660 changed files with 12034344 additions and 0 deletions

View file

@ -0,0 +1,19 @@
Copyright (c) 2017-present Jamie Kyle <me@thejameskyle.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,39 @@
# ci-parallel-vars
> Get CI environment variables for parallelizing builds
## Install
```
yarn add ci-parallel-vars
```
## Usage
```js
const ciParallelVars = require('ci-parallel-vars');
console.log(ciParallelVars); // { index: 3, total: 10 } || null
```
## Supports
> If you want to add support for another pair, please open a pull request and
> add them to `index.js` and to this list.
- [Knapsack] / [TravisCI] / [GitLab] - `CI_NODE_INDEX`/`CI_NODE_TOTAL`
- [CircleCI] - `CIRCLE_NODE_INDEX`/`CIRCLE_NODE_TOTAL`
- [Bitbucket Pipelines] - `BITBUCKET_PARALLEL_STEP`/`BITBUCKET_PARALLEL_STEP_COUNT`
- [Buildkite] - `BUILDKITE_PARALLEL_JOB`/`BUILDKITE_PARALLEL_JOB_COUNT`
- [Semaphore] - `SEMAPHORE_CURRENT_JOB`/`SEMAPHORE_JOB_COUNT`
One of these pairs must both be defined as numbers or `ci-parallel-vars` will
be `null`.
[Knapsack]: http://docs.knapsackpro.com/ruby/knapsack#info-about-env-variables
[TravisCI]: https://docs.travis-ci.com/user/speeding-up-the-build/#Parallelizing-RSpec%2C-Cucumber-and-Minitest-on-multiple-VMs
[GitLab]: https://docs.gitlab.com/ee/ci/yaml/#parallel
[CircleCI]: https://circleci.com/docs/1.0/parallel-manual-setup/#using-environment-variables
[Bitbucket Pipelines]: https://confluence.atlassian.com/bitbucket/parallel-steps-946606807.html
[Buildkite]: https://buildkite.com/docs/builds/parallel-builds
[Semaphore]: https://semaphoreci.com/docs/available-environment-variables.html#variables-exported-in-builds-and-deploys

View file

@ -0,0 +1,56 @@
// @flow
'use strict';
/*::
type Match = null | { index: number, total: number };
*/
const envs = [
// Knapsack / TravisCI / GitLab
{
index: 'CI_NODE_INDEX',
total: 'CI_NODE_TOTAL',
},
// CircleCI
{
index: 'CIRCLE_NODE_INDEX',
total: 'CIRCLE_NODE_TOTAL',
},
// Bitbucket Pipelines
{
index: 'BITBUCKET_PARALLEL_STEP',
total: 'BITBUCKET_PARALLEL_STEP_COUNT',
},
// Buildkite
{
index: 'BUILDKITE_PARALLEL_JOB',
total: 'BUILDKITE_PARALLEL_JOB_COUNT',
},
// Semaphore
{
index: 'SEMAPHORE_CURRENT_JOB',
total: 'SEMAPHORE_JOB_COUNT',
},
];
let maybeNum = val => {
let num = parseInt(val, 10);
return Number.isNaN(num) ? null : num;
};
let match /*: Match */ = null;
for (let env of envs) {
let index = maybeNum(process.env[env.index]);
let total = maybeNum(process.env[env.total]);
if (index !== null && total !== null) {
if (process.env.GITLAB_CI) {
index = index - 1;
}
match = { index, total };
break;
}
}
module.exports = match;

View file

@ -0,0 +1,36 @@
{
"name": "ci-parallel-vars",
"version": "1.0.1",
"description": "Get CI environment variables for parallelizing builds",
"main": "index.js",
"repository": "https://github.com/jamiebuilds/ci-parallel-vars",
"author": "Jamie Kyle <me@thejameskyle.com>",
"license": "MIT",
"keywords": [
"ci",
"env",
"vars",
"index",
"total",
"parallel",
"builds",
"tests",
"travis",
"circle",
"buildkite",
"bitbucket",
"pipelines",
"knapsack"
],
"files": [
"index.js"
],
"scripts": {
"test": "ava"
},
"devDependencies": {
"ava": "^0.25.0",
"flow-bin": "^0.73.0",
"spawndamnit": "^2.0.0"
}
}