Skip to content

Commit

Permalink
Merge branch 'feature/ci' into 'main'
Browse files Browse the repository at this point in the history
ci: update ci for gitlab

See merge request gperdomor/nx-tools!6
  • Loading branch information
gperdomor committed Aug 5, 2024
2 parents c434275 + 278d6ec commit d8ff729
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
34 changes: 25 additions & 9 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,44 @@
include:
- template: Workflows/MergeRequest-Pipelines.gitlab-ci.yml
- component: gitlab.com/gl-components/nx-set-shas/[email protected]

workflow:
auto_cancel:
on_new_commit: conservative

default:
image: node:20

variables:
CI: 'true'
GIT_DEPTH: 0
NX_CLOUD_ACCESS_TOKEN: $NX_CLOUD_TOKEN

.node-cache: &node-cache
key:
files:
- package-lock.json
paths:
- .npm/
policy: pull

# Main job
CI:
interruptible: true
only:
- main
- merge_requests
cache:
<<: *node-cache
policy: pull-push
script:
# Connect your workspace on nx.app and uncomment this to enable task distribution.
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "build" targets have been requested
- npx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build"
# This enables task distribution via Nx Cloud
# Run this command as early as possible, before dependencies are installed
# Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun
# Connect your workspace by running "nx connect" and uncomment this
# - npx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build"

- npm ci
- NX_HEAD=$CI_COMMIT_SHA
- NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA}
- npm ci --cache .npm --prefer-offline

# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
# - npx nx-cloud record -- echo Hello World
- npx nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
- npx nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/tmp
/.nx/cache
/.nx/workspace-data
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"!{projectRoot}/src/test-setup.[jt]s",
"!{projectRoot}/test-setup.[jt]s"
],
"sharedGlobals": []
"sharedGlobals": ["{workspaceRoot}/.gitlab-ci.yml"]
},
"nxCloudAccessToken": "YTA4ZDcwNjQtMDZmNC00YjUyLTk5ZTMtN2E1ZDE1ZTkwMWYxfHJlYWQ=",
"targetDefaults": {
Expand Down

0 comments on commit d8ff729

Please sign in to comment.