Skip to content

Commit ba040d3

Browse files
author
Ron Netzer
committed
revert v2.2.3
1 parent eb3af60 commit ba040d3

File tree

11 files changed

+286
-0
lines changed

11 files changed

+286
-0
lines changed

.idea/.gitignore

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/aws.xml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/nx-distributed-task.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# @e-square/nx-distributed-task
2+
3+
[![NPM](https://img.shields.io/github/package-json/v/e-square-io/nx-distributed-task?&logo=npm&style=flat-square)]()
4+
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/e-square-io/nx-github-actions/Main%20Workflow/main?event=push&logo=github&style=flat-square)](https://github.com/e-square-io/nx-github-actions/actions/workflows/main.yml)
5+
[![Codecov](https://img.shields.io/codecov/c/github/e-square-io/nx-github-actions?logo=codecov&style=flat-square&token=PVPVUJAD1X)](https://app.codecov.io/gh/e-square-io/nx-github-actions)
6+
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](https://github.com/e-square-io/nx-github-actions#contributors-)
7+
[![MIT](https://img.shields.io/packagist/l/doctrine/orm.svg?style=flat-square)](https://github.com/e-square-io/nx-github-actions/blob/main/LICENSE)
8+
9+
## Summary
10+
11+
Github Action that runs nx `run-many` for the specified target and projects.
12+
This action was designed to consume the outputs of [@e-square/nx-affected-matrix](https://github.com/marketplace/actions/nx-affected-task) in order to distribute jobs with ease.
13+
14+
Check out the monorepo's [README](https://github.com/e-square-io/nx-github-actions#usage) for a full usage example of both actions with GitHub Actions' matrix
15+
16+
## Usage
17+
18+
### Inputs
19+
20+
| name | description | default | required |
21+
| :--------------- | :---------------------------------------------------------- | :-----: | :------: |
22+
| target | Target to run | - | ✓ |
23+
| projects | Comma-delimited list of projects to run against target | - | ✓ |
24+
| distribution | Current distribution run, required when running in a matrix | - | ✗ |
25+
| maxParallel | Maximum NX cli parallel runs | 3 | ✗ |
26+
| nxCloud | Enable support of Nx Cloud | false | ✗ |
27+
| uploadOutputs | Upload target's outputs as workflow artifacts | true | ✗ |
28+
| workingDirectory | Path to the Nx workspace, needed if not the repository root | - | ✗ |
29+
| args | Space-delimited args to add to nx command execution | - | ✗ |
30+
31+
```yaml
32+
jobs:
33+
execute:
34+
runs-on: ubuntu-latest
35+
name: Execute NX
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v2
39+
40+
# install node modules, cache etc
41+
42+
- name: Run command
43+
uses: e-square-io/nx-distributed-task@v2
44+
with:
45+
target: 'test'
46+
projects: 'project1,project2'
47+
```
48+
49+
### Uploading outputs
50+
51+
In Github, when uploading multiple artifact under the same name, Github will keep adding the artifacts instead of overwriting them.
52+
This behavior allows us to upload all the outputs from all the distributed jobs under one "directory" so that in later jobs you can download that single "directory" and get all the outputs for that target.
53+
The name of the artifact will be the name of the target.

action.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: 'Nx distributed task'
2+
branding:
3+
icon: command
4+
color: white
5+
author: 'e-square.io'
6+
description: 'Executes Nx task'
7+
inputs:
8+
target:
9+
description: 'Target to run'
10+
required: true
11+
projects:
12+
description: 'Comma-delimited list of projects to run against target'
13+
required: false
14+
default: ''
15+
distribution:
16+
description: 'Current distribution run, required when running in a matrix'
17+
required: false
18+
bucket:
19+
description: 'Current distribution run, required when running in a matrix'
20+
required: false
21+
deprecationMessage: 'deprecated, use distribution input instead'
22+
maxParallel:
23+
description: 'Maximum NX cli parallel runs'
24+
required: false
25+
default: '3'
26+
uploadOutputs:
27+
description: "Should upload target's outputs from all distributed jobs"
28+
required: false
29+
default: 'true'
30+
args:
31+
description: 'space-delimited args to add to nx command execution'
32+
required: false
33+
nxCloud:
34+
description: 'Enable support of Nx Cloud'
35+
required: false
36+
default: 'false'
37+
workingDirectory:
38+
description: 'Path to the Nx workspace, needed if not the repository root'
39+
required: false
40+
debug:
41+
description: 'Enable Debug mode. Will not execute the target'
42+
required: false
43+
default: 'false'
44+
runs:
45+
using: 'composite'
46+
steps:
47+
- name: Execute target
48+
uses: actions/github-script@v6
49+
with:
50+
script: |
51+
const { default: setEnv } = require('${{ github.action_path }}/set-env.js');
52+
const { default: main } = require('${{ github.action_path }}/main.js');
53+
54+
setEnv(${{ toJSON(inputs) }}, process);
55+
await main(context, core, exec, glob, io, require);
56+
57+
- name: Post Execute target
58+
if: ${{ !fromJSON(inputs.nxCloud) }}
59+
uses: actions/github-script@v6
60+
with:
61+
script: |
62+
const { default: setEnv } = require('${{ github.action_path }}/set-env.js');
63+
const { default: main } = require('${{ github.action_path }}/main.js');
64+
65+
setEnv(${{ toJSON(inputs) }}, process);
66+
await main(context, core, exec, glob, io, require);

main.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.js.LICENSE.txt

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
/*!
2+
* Copyright (c) 2015, Salesforce.com, Inc.
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice,
9+
* this list of conditions and the following disclaimer.
10+
*
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
*
15+
* 3. Neither the name of Salesforce.com nor the names of its contributors may
16+
* be used to endorse or promote products derived from this software without
17+
* specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29+
* POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
32+
/*!
33+
* Copyright (c) 2018, Salesforce.com, Inc.
34+
* All rights reserved.
35+
*
36+
* Redistribution and use in source and binary forms, with or without
37+
* modification, are permitted provided that the following conditions are met:
38+
*
39+
* 1. Redistributions of source code must retain the above copyright notice,
40+
* this list of conditions and the following disclaimer.
41+
*
42+
* 2. Redistributions in binary form must reproduce the above copyright notice,
43+
* this list of conditions and the following disclaimer in the documentation
44+
* and/or other materials provided with the distribution.
45+
*
46+
* 3. Neither the name of Salesforce.com nor the names of its contributors may
47+
* be used to endorse or promote products derived from this software without
48+
* specific prior written permission.
49+
*
50+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
51+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
54+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
55+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
56+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
57+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
58+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
59+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
60+
* POSSIBILITY OF SUCH DAMAGE.
61+
*/
62+
63+
/*!
64+
* Tmp
65+
*
66+
* Copyright (c) 2011-2017 KARASZI Istvan <[email protected]>
67+
*
68+
* MIT Licensed
69+
*/
70+
71+
/*!
72+
* mime-db
73+
* Copyright(c) 2014 Jonathan Ong
74+
* MIT Licensed
75+
*/
76+
77+
/*!
78+
* mime-types
79+
* Copyright(c) 2014 Jonathan Ong
80+
* Copyright(c) 2015 Douglas Christopher Wilson
81+
* MIT Licensed
82+
*/
83+
84+
/*! *****************************************************************************
85+
Copyright (c) Microsoft Corporation.
86+
87+
Permission to use, copy, modify, and/or distribute this software for any
88+
purpose with or without fee is hereby granted.
89+
90+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
91+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
92+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
93+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
94+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
95+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
96+
PERFORMANCE OF THIS SOFTWARE.
97+
***************************************************************************** */
98+
99+
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */

package.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "@e-square/nx-distributed-task",
3+
"version": "1.0.0",
4+
"repository": {
5+
"type": "git",
6+
"url": "git+https://github.com/e-square-io/nx-github-actions.git",
7+
"directory": "packages/nx-distributed-task"
8+
},
9+
"bugs": {
10+
"url": "https://github.com/e-square-io/nx-github-actions/issues"
11+
},
12+
"dependencies": {
13+
"@actions/artifact": "^0.6.1",
14+
"@actions/cache": "^1.0.8"
15+
},
16+
"main": "main.js"
17+
}

0 commit comments

Comments
 (0)