Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support yarn berry #43

Merged
merged 7 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 }}-yarn-${{ hashFiles('**/yarn.lock') }}
Michsior14 marked this conversation as resolved.
Show resolved Hide resolved
restore-keys: |
${{ runner.os }}-yarn-

- 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 }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- 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