mansagroup / nrwl-nx-action Goto Github PK
View Code? Open in Web Editor NEWA GitHub Action to wrap Nrwl Nx commands in your workflows.
License: MIT License
A GitHub Action to wrap Nrwl Nx commands in your workflows.
License: MIT License
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Location: .github/renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: Invalid configuration option: node
Getting the next error.
2022-07-17T14:52:15.3296818Z added 109 packages, and audited 110 packages in 3s
2022-07-17T14:52:15.3297245Z
2022-07-17T14:52:15.3297593Z 18 packages are looking for funding
2022-07-17T14:52:15.3298014Z run `npm fund` for details
2022-07-17T14:52:15.3307014Z
2022-07-17T14:52:15.3307270Z found 0 vulnerabilities
2022-07-17T14:52:15.3443968Z ##[group]Run mansagroup/nrwl-nx-action@v2
2022-07-17T14:52:15.3444233Z with:
2022-07-17T14:52:15.3444415Z projects: mobile
2022-07-17T14:52:15.3444619Z targets: init
2022-07-17T14:52:15.3444815Z all: false
2022-07-17T14:52:15.3444996Z affected: true
2022-07-17T14:52:15.3445212Z parallel: false
2022-07-17T14:52:15.3445424Z maxParallel: 3
2022-07-17T14:52:15.3445612Z nxCloud: false
2022-07-17T14:52:15.3445811Z env:
2022-07-17T14:52:15.3446043Z FLUTTER_ROOT: /opt/hostedtoolcache/flutter
2022-07-17T14:52:15.3446331Z PUB_CACHE: /opt/hostedtoolcache/flutter/.pub-cache
2022-07-17T14:52:15.3446587Z ##[endgroup]
2022-07-17T14:52:15.4046704Z ##[group]๐ Ensuring Nx is available
2022-07-17T14:52:15.4068649Z Found package.json file
2022-07-17T14:52:15.4069674Z ##[endgroup]
2022-07-17T14:52:15.4097289Z ##[error]Error: Failed to locate the 'nx' script in package.json, did you setup your project with Nx's CLI?
2022-07-17T14:52:15.4186118Z Post job cleanup.
2022-07-17T14:52:15.4220878Z Post job cleanup.
Should run the command
provide possibility to run with npx
Others:
I believe the git boundaries are not being defined correctly when not using a merge or squash commit to a branch that runs your workflow.
If you choose rebase merge in your PR to add directly onto the target branch even if that PR contained 10 commits the base ref would be set to HEAD~1. I believe the same would happen if you pushed multiple commits directly to master/main without using a PR.
When pushing to master the base ref should be reported as the target HEAD before the PR was merged.
My current flow for running the CI is the following :
master
I am wondering how I can run affected
running a comparison between the last commit of master --base=master
and the last commit of the current branch.
Here is an example of my .github-action
configuration:
test:
name: Test
runs-on: ubuntu-latest
needs: install-deps # other job installing the deps => npm i
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v2
with:
node-version: "14"
- name: Cache node modules
id: cache
uses: actions/cache@v2
with:
path: node_modules
key: cache-node-modules-${{ hashFiles('package-lock.json') }}
- uses: mansagroup/nrwl-nx-action@v2
with:
args: --verbose=false
targets: test
When running the CI I have the following error :
nx "affected" "--target=test" "--base=bb2066fa076f1afc2cf0ced20096b56f2ad51c80" "--head=78f6e6aabdc9541d462fdba1ce770342068f2db2" "--verbose=false"
fatal: Not a valid commit name bb2066fa076f1afc2cf0ced20096b56f2ad51c80
fatal: No such ref: 'bb2066fa076f1afc2cf0ced20096b56f2ad51c80'
...
Error: Command failed: git merge-base --fork-point "bb2066fa076f1afc2cf0ced20096b56f2ad51c80" "78f6e6aabdc9541d462fdba1ce770342068f2db2"
fatal: No such ref: 'bb2066fa076f1afc2cf0ced20096b56f2ad51c80'
I am not sure if I should be able to fix my issue, I want to be able to define my base being master
.
Did I miss something or nrwl-nx-action
should provide an API to resolve my issue ?
When using Nx Cloud, the --scan
param is added. However, it has been deprecated and now results in errors:
https://github.com/nx-squeezer/squeezer/actions/runs/3303923794/jobs/5452427490
Run mansagroup/[email protected]
with:
targets: e[2](https://github.com/nx-squeezer/squeezer/actions/runs/3303923794/jobs/5452427490#step:6:2)e
affected: true
parallel: 1
nxCloud: true
all: false
env:
NX_RUN_GROUP: [3](https://github.com/nx-squeezer/squeezer/actions/runs/3303923794/jobs/5452427490#step:6:3)30392379[4](https://github.com/nx-squeezer/squeezer/actions/runs/3303923794/jobs/5452427490#step:6:4)
NX_CLOUD_AUTH_TOKEN: ***
NX_BASE: 990f3da1988d2719eb4eb2d[5](https://github.com/nx-squeezer/squeezer/actions/runs/3303923794/jobs/5452427490#step:6:5)a[6](https://github.com/nx-squeezer/squeezer/actions/runs/3303923794/jobs/5452427490#step:6:6)c1580e252b1b99
NX_HEAD: b3a913818ee698ce[7](https://github.com/nx-squeezer/squeezer/actions/runs/3303923794/jobs/5452427490#step:6:7)e5994df6e2a6d94e2[8](https://github.com/nx-squeezer/squeezer/actions/runs/3303923794/jobs/5452427490#step:6:8)270d5
๐ท Retrieving Git boundaries (affected command)
/opt/hostedtoolcache/node/16.17.1/x64/bin/npx nx affected --target=e2e --base=[9](https://github.com/nx-squeezer/squeezer/actions/runs/3303923794/jobs/5452427490#step:6:9)90f3da1988d2719eb4eb2d5a6c1580e252b1b99 --head=bc2a795eb3d51caef0f5dee40d73e649[18](https://github.com/nx-squeezer/squeezer/actions/runs/3303923794/jobs/5452427490#step:6:20)f0ee04 --scan --parallel=1
> NX Running target e2e for 1 project(s):
- workspace-e2e
With additional flags:
--scan=true
> nx run workspace-e2e:e2e --scan=true
> NX 'scan' is not found in schema
scan
argument is no longer used
Just remove it
Others:
Reference:
When passing parallel: 'false'
it does not pass the param. Since the default is --parallel=3
, it will result in parallelization
Passing parallel: 'false'
doesn't result in parallelization
Convert it into --parallel=1
Others:
I've faced the error Failed to locate the 'nx' script in package.json
so I found the function assertHasNxPackageScript
in this code base. this function checks package.json
for nx commands. but I don't have the "nx" command even I started a project with nx-cli
.
async function assertHasNxPackageScript(): Promise<void> {
const packageJson = await loadPackageJson().catch(() => {
throw new Error(
"Failed to load the 'package.json' file, did you setup your project correctly?",
);
});
core.info('Found package.json file');
if (typeof packageJson.scripts?.nx !== 'string') // this line
throw new Error(
"Failed to locate the 'nx' script in package.json, did you setup your project with Nx's CLI?",
);
core.info("Found 'nx' script inside package.json file");
}
I actually don't know if this function has a bug. but if you know any solution please guide me. thx :)
P.S. I'm using act for the test locally
At the off-chance that the issue is related to this GH action, I am linking it.
Running action in GitHub, get error that can't load package.json.
Package.json is loaded
Others:
Action:
on:
pull_request:
branches: [develop]
jobs:
lint_and_build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Directory change
run: |
cd <nx_directory>
- name: Nrwl Nx
uses: MansaGroup/[email protected]
with:
targets: lint, build
Output:
Run MansaGroup/[email protected]
๐ Ensuring Nx is available
Error: Error: Failed to load the 'package.json' file, did you setup your project correctly?
I put a pwd
and ls
in the Directory Change step to ensure I was in the right place, the output included the proper package.json
file.
Need ability to use custom targets with MansaGroup/[email protected]
.
I'm using @flowaccount/nx-serverless
to facilitate deploying serverless projects in NX to AWS lambda. @flowaccount/nx-serverless
modifies NX project with additional targets like deploy, offline, and sls. It seems MansaGroup/[email protected]
does not support targets other than build, serve, lint, and test.
I'm trying to chain together @flowaccount/nx-serverless
with MansaGroup/[email protected]
to create a GitHUb workflow for deploying affected projects to AWS when a pull requests is closed. However, I'm getting this error:
Here is my GitHUb Workflow YML file:
name: pull-request
env:
AWS_REGION_NAME: "us-east-2"
on:
pull_request:
branches:
- main
types: [closed]
jobs:
deploy:
name: deploy app
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- name: checkout code
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0
- name: use node.js ${{ matrix.node-version }}
uses: actions/setup-node@master
with:
always-auth: true
node-version: ${{ matrix.node-version }}
- name: install Nrwl Nx
run: npm i nx
- name: Fetch other branches
run: git fetch --no-tags --prune --depth=5 origin $GITHUB_BASE_REF
- name: install dependencies
run: npm ci
- name: Nrwl Nx
uses: MansaGroup/[email protected]
with:
targets: build, deploy
projects: occupations-api
args: --base=origin/main --stage=dev --configuration=dev
I'd like to be able to utilize custom targets with MansaGroup/[email protected]
. In addition to the targets from @flowaccount/nx-serverless
, perhaps ability to run my own custom targets. I can create custom targets with NX using @nrwl/workspace:run-commands
builder.
Adding this capability will aid in making flexible GitHub Actions workfflows.
Following this comment from @ValeriyMaslenikov. I'm questioning myself how to place the arguments in the Nx command:
--
will cause them to be ignored by Nx--configuration=prod
to handle production builds)--
will require anybody to add them on their own for their arguments to be handled correctly by the executor (and not by Nx directly)Two solutions:
nxArgs
(or something like that) to the action for specific arguments to add before the --
--
manually, which could lead to hard debuggingCompletely ignore the nx-set-shas action, advised by the documentation: https://nx.dev/recipes/ci/monorepo-ci-github-actions
The base is not correct in this action, even if nx-set-shas set it before.
Don't override NX_BASE if it is set in the environment variables
It should use the NX_BASE environment variable by default, to leverage nx-set-shas action
Others:
Latest version 3.2.2
For builds you may want to build targeting production within your CI or other environments.
Add an input for flags passed to the commands. The main drawback here is that the flags would be the same for each target passed, and it may require splitting the targets out into different steps of the GHA workflow.
Whenever I am running the CI/CD, getting the following error:
Run mansagroup/nrwl-nx-action@v2
๐ Working in custom directory: ./
๐ Ensuring Nx is available
/opt/hostedtoolcache/node/16.17.1/x64/bin/npm run nx -- run-many --target=lint --all
[email protected] nx
nx
/tmp/nx-d1766103.sh: 1: nx: not found
Error: Error: The process '/opt/hostedtoolcache/node/16.17.1/x64/bin/npm' failed with exit code 127
Code:
name: Nx CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
with:
node-version: 16
- uses: mansagroup/nrwl-nx-action@v2
with:
targets: lint,build
all: 'true'
workingDirectory: ./
This error is occurring every time.
Hello!
I'm trying to run the action with "projects" parameters, and instead of running only the project I defined, the action runs all the projects.
main.yml:
- name: Nrwl Nx uses: MansaGroup/[email protected] with: targets: e2e args: --verbose --mainArgs="--port=5000" affected: false projects: solar-dashboard-e2e all: false
The result:
`/usr/local/bin/npx nx run-many --target=e2e --all --verbose --mainArgs=--port=5000 --parallel=3
NX Running target e2e for 4 project(s):
With flags:
--verbose=true
--mainArgs=--port=5000`
I tried it also without "all"- same results.
This isn't really a feature request, rather me trying to get some clarification. I was reviewing your action here https://github.com/marketplace/actions/nrwl-nx. I see that you guys have mentioned that build, test, lint, and deploy are all included. I was wondering if I could also run e2e tests on affected projects with this action out of the box, or if I would need to configure that myself.
When specifying args that contain a space in the value part of the arg, like so:
args: --alias=test --message="test test test"
The command that will get executed (in this case it's nx affected
but seems like it would happen to any command that supports the args
property) will end up being something like this:
nx affected --target=build '--alias=test' '--message="test' test 'test"'
This ends up passing the message
arg as "test'
. I've tried a lot of different variations with quotes and such, but can't seem to get past the space causing an issue (other than sending no space at all).
This seems to be due to the way that this action is splitting the args
property here: https://github.com/MansaGroup/nrwl-nx-action/blob/main/src/index.ts#L27
I'd expect that the above YAML would run a command like so:
nx affected --target=build '--alias=test' '--message="test test test"'
I want to build only the affected apps when I create a new tag. The problem is that on a tag the last commit is only zeros. Is it possible that this works? My workaround is to build everything. :/
Build only the affected apps.
$ nx affected --target=lint --base=0000000000000000000000000000000000000000 --head=6cb6624933ed92b53c116d2271b23af57916b70a
fatal: Not a valid commit name 0000000000000000000000000000000000000000
fatal: No such ref: '0000000000000000000000000000000000000000'
Documentation says to use v2 but I get
Error: Unable to resolve action `MansaGroup/nrwl-nx-action@v2`, unable to find version `v2`
however using v2.0.4 works
All Contributors could update the README.md file if needed, saving quite some time.
Hi everyone, I am trying to figure out why my workflow keeps crashing. When entering the NX step the following will be shown in the GitHub Actions console:
Run mansagroup/nrwl-nx-action@v2
๐ Ensuring Nx is available
Error: Error: Failed to locate the 'nx' script in package.json, did you setup your project with Nx's CLI?
I have tried yarn
as well as npm
both with the same results. However in our project we are only using yarn
as our package manager. Here ist the workflow.yaml:
name: Tests, Docs, Changelogs, Publish
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build_lint_test_docs_readme_publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "19.x"
registry-url: https://registry.npmjs.org/
cache: "yarn"
- name: Install Repo deps
run: yarn install
- name: Configure CI Git User
run: |
git config --global user.email [email protected]
git config --global user.name GitHub Actions
- name: Run NX Tasks
uses: mansagroup/nrwl-nx-action@v2
with:
targets: version
projects: array-utils
env:
NODE_AUTH_TOKEN: ${{ secrets.DREAM_BIT_UTILS_NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: ๐ Automated Docs and Readmes
Error will show up while checking in the task mansagroup/nrwl-nx-action@v2
.
It should run the wanted NX task for the choosen project.
I don't know at the moment.
Others:
I'm running into a bug with version 2.1.0
and 2.0.3
OS: Ubuntu 18.04.5 LTS
Run mansagroup/[email protected]
with:
nxCloud: true
targets: lint,test,build,deploy
all: false
affected: true
parallel: false
maxParallel: 3
env:
NX_BRANCH:
NX_HEAD:
NX_RUN_GROUP: 614141274
TAG: 9f79beb6b5d95548db67ef9b1c63e1cc8e16c19c
๐ Ensuring Nx is available
Found package.json file
Found 'nx' script inside package.json file
Using npm as package manager
๐ท Retrieving Git boundaries (affected command)
/usr/bin/git rev-parse HEAD~1
fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
HEAD~1
Error: Error: The process '/usr/bin/git' failed with exit code 128
This issue provides visibility into Renovate updates and their statuses. Learn more
These updates await pending status checks. To force their creation now, click the checkbox below.
jest
, jest-circus
)A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.