Skip to content

Commit

Permalink
feat: support yarn berry (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michsior14 committed Nov 14, 2022
1 parent aeb34b1 commit a27717a
Show file tree
Hide file tree
Showing 56 changed files with 15,659 additions and 18 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci-integration-test-yarn-berry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI - integration test yarn berry

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true

jobs:
main:
name: Nx Cloud - Main Job
uses: ./.github/workflows/nx-cloud-main.yml
with:
working-directory: ./integration-tests/yarn-berry
parallel-commands: |
yarn nx workspace-lint
yarn nx format:check
parallel-commands-on-agents: |
yarn nx affected --target=lint --parallel=3
yarn nx affected --target=test --parallel=3 --ci --code-coverage
yarn nx affected --target=build --parallel=3
agents:
name: Nx Cloud - Agents
uses: ./.github/workflows/nx-cloud-agents.yml
with:
working-directory: ./integration-tests/yarn-berry
number-of-agents: 3
10 changes: 5 additions & 5 deletions .github/workflows/ci-integration-test-yarn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
with:
working-directory: ./integration-tests/yarn
parallel-commands: |
npx nx workspace-lint
npx nx format:check
yarn nx workspace-lint
yarn nx format:check
parallel-commands-on-agents: |
npx nx affected --target=lint --parallel=3
npx nx affected --target=test --parallel=3 --ci --code-coverage
npx nx affected --target=build --parallel=3
yarn nx affected --target=lint --parallel=3
yarn nx affected --target=test --parallel=3 --ci --code-coverage
yarn nx affected --target=build --parallel=3
agents:
name: Nx Cloud - Agents
Expand Down
32 changes: 26 additions & 6 deletions .github/workflows/nx-cloud-agents.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ jobs:
if [[ $pnpm_ver != '' ]]; then echo "PNPM: $pnpm_ver"; fi
echo "node_version=${node_ver:1}" >> $GITHUB_OUTPUT
echo "yarn_version=${yarn_ver:1}" >> $GITHUB_OUTPUT
- name: Use the node_modules cache if available [npm]
if: steps.package_manager.outputs.name == 'npm'
Expand All @@ -128,20 +129,34 @@ jobs:
restore-keys: |
${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-
- name: Get yarn cache directory path
if: steps.package_manager.outputs.name == 'yarn'
- name: Get yarn cache directory path [yarn 1.x]
if: steps.package_manager.outputs.name == 'yarn' && startsWith(steps.versions.outputs.yarn_version, '1.')
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Use the node_modules cache if available [yarn]
if: steps.package_manager.outputs.name == 'yarn'
- name: Use the node_modules cache if available [yarn 1.x]
if: steps.package_manager.outputs.name == 'yarn' && startsWith(steps.versions.outputs.yarn_version, '1.')
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn-
- name: Get yarn cache directory path [yarn berry]
if: steps.package_manager.outputs.name == 'yarn' && !startsWith(steps.versions.outputs.yarn_version, '1.')
id: yarn-berry-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: Use the node_modules cache if available [yarn berry]
if: steps.package_manager.outputs.name == 'yarn' && !startsWith(steps.versions.outputs.yarn_version, '1.')
uses: actions/cache@v3
with:
path: ${{ steps.yarn-berry-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn-berry-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn-berry-
- name: Process environment-variables
if: ${{ inputs.environment-variables != '' }}
uses: actions/github-script@v6
Expand Down Expand Up @@ -190,8 +205,13 @@ jobs:
if: ${{ inputs.install-commands == '' }}
run: |
if [ "${{ steps.package_manager.outputs.name == 'yarn' }}" == "true" ]; then
echo "Running yarn install --frozen-lockfile"
yarn install --frozen-lockfile
if [ "${{ startsWith(steps.versions.outputs.yarn_version, '1.') }}" == "true" ]; then
echo "Running yarn install --frozen-lockfile"
yarn install --frozen-lockfile
else
echo "Running yarn install --immutable"
yarn install --immutable
fi
elif [ "${{ steps.package_manager.outputs.name == 'pnpm' }}" == "true" ]; then
echo "Running pnpm install --frozen-lockfile"
pnpm install --frozen-lockfile
Expand Down
32 changes: 26 additions & 6 deletions .github/workflows/nx-cloud-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ jobs:
if [[ $pnpm_ver != '' ]]; then echo "PNPM: $pnpm_ver"; fi
echo "node_version=${node_ver:1}" >> $GITHUB_OUTPUT
echo "yarn_version=${yarn_ver:1}" >> $GITHUB_OUTPUT
- name: Use the node_modules cache if available [npm]
if: steps.package_manager.outputs.name == 'npm'
Expand All @@ -155,20 +156,34 @@ jobs:
restore-keys: |
${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-
- name: Get yarn cache directory path
if: steps.package_manager.outputs.name == 'yarn'
- name: Get yarn cache directory path [yarn 1.x]
if: steps.package_manager.outputs.name == 'yarn' && startsWith(steps.versions.outputs.yarn_version, '1.')
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Use the node_modules cache if available [yarn]
if: steps.package_manager.outputs.name == 'yarn'
- name: Use the node_modules cache if available [yarn 1.x]
if: steps.package_manager.outputs.name == 'yarn' && startsWith(steps.versions.outputs.yarn_version, '1.')
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn-
- name: Get yarn cache directory path [yarn berry]
if: steps.package_manager.outputs.name == 'yarn' && !startsWith(steps.versions.outputs.yarn_version, '1.')
id: yarn-berry-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- name: Use the node_modules cache if available [yarn berry]
if: steps.package_manager.outputs.name == 'yarn' && !startsWith(steps.versions.outputs.yarn_version, '1.')
uses: actions/cache@v3
with:
path: ${{ steps.yarn-berry-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn-berry-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn-berry-
- name: Process environment-variables
if: ${{ inputs.environment-variables != '' }}
uses: actions/github-script@v6
Expand Down Expand Up @@ -217,8 +232,13 @@ jobs:
if: ${{ inputs.install-commands == '' }}
run: |
if [ "${{ steps.package_manager.outputs.name == 'yarn' }}" == "true" ]; then
echo "Running yarn install --frozen-lockfile"
yarn install --frozen-lockfile
if [ "${{ startsWith(steps.versions.outputs.yarn_version, '1.') }}" == "true" ]; then
echo "Running yarn install --frozen-lockfile"
yarn install --frozen-lockfile
else
echo "Running yarn install --immutable"
yarn install --immutable
fi
elif [ "${{ steps.package_manager.outputs.name == 'pnpm' }}" == "true" ]; then
echo "Running pnpm install --frozen-lockfile"
pnpm install --frozen-lockfile
Expand Down
13 changes: 13 additions & 0 deletions integration-tests/yarn-berry/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
max_line_length = off
trim_trailing_whitespace = false
35 changes: 35 additions & 0 deletions integration-tests/yarn-berry/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:@nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nrwl/nx/javascript"],
"rules": {}
}
]
}
39 changes: 39 additions & 0 deletions integration-tests/yarn-berry/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
.DS_Store
Thumbs.db
4 changes: 4 additions & 0 deletions integration-tests/yarn-berry/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Add files here to ignore them from prettier formatting

/dist
/coverage
3 changes: 3 additions & 0 deletions integration-tests/yarn-berry/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": true
}
8 changes: 8 additions & 0 deletions integration-tests/yarn-berry/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"firsttris.vscode-jest-runner",
"dbaeumer.vscode-eslint"
]
}
Binary file not shown.

0 comments on commit a27717a

Please sign in to comment.