Skip to content

Commit

Permalink
ci(github): migrate yarn to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
ratson committed May 20, 2023
1 parent 07e29de commit 2aff792
Show file tree
Hide file tree
Showing 5 changed files with 43,664 additions and 99 deletions.
144 changes: 49 additions & 95 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,67 +10,58 @@ on:

jobs:
test:
name: Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
name: Node.js v${{ matrix.node-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 17.x]
node-version: [20, 18, 16]
os: [ubuntu-latest, windows-latest, macos-latest]
exclude:
- os: macos-latest
node-version: 12.x
node-version: 12
- os: macos-latest
node-version: 14.x
node-version: 14
steps:
- name: Config git
run: git config --global core.autocrlf input

- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: pnpm

- name: Restore Node cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
.eslintcache
yarn.lock
.yarnrc.yml
.yarn
node_modules
*/node_modules
*/*/node_modules
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}-${{ secrets.CACHE_VERSION }}

- name: Config Yarn
run: |
yarn set version berry
yarn --version
yarn set version from sources
yarn --version
yarn config set enableImmutableInstalls false
yarn config set pnpFallbackMode all
yarn config set pnpMode loose
if: hashFiles('.yarnrc.yml') == ''

- name: Install dependencies
run: |
yarn
run: pnpm install --frozen-lockfile

- name: Build
run: |
pnpm prepare
pushd packages/cordova
npx nx build
popd
pushd internal/rollup-config
yarn build
# pnpm prepack
popd
yarn lerna run --stream prepublishOnly
# pnpm lerna run --stream prepublishOnly
- name: Test
run: |
yarn lint
yarn test
# pnpm lint
pnpm test
shell: bash

test-android:
Expand All @@ -82,7 +73,8 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v2
Expand All @@ -91,31 +83,22 @@ jobs:
java-version: '8'

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: pnpm

- name: Restore Node cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
yarn.lock
.yarn
node_modules
*/node_modules
*/*/node_modules
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}-${{ secrets.CACHE_VERSION }}

- name: Config Yarn
run: |
yarn set version berry
yarn set version from sources
yarn config set enableImmutableInstalls false
yarn config set pnpFallbackMode all
yarn config set pnpMode loose
- name: Restore Gradle cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
Expand All @@ -128,22 +111,19 @@ jobs:
run: |
echo "/usr/local/lib/android/sdk/platform-tools" >> $GITHUB_PATH
echo "/usr/local/lib/android/sdk/tools" >> $GITHUB_PATH
yarn
yarn prepare
yarn workspace '@admob-plus-internal/cli' prepack
yarn workspace '@admob-plus-internal/rollup-config' prepack
pnpm i
pushd examples/cordova
yarn prepare
yarn example cordova platform rm ios
pnpm cordova prepare
pnpm cordova platform rm ios
popd
#
- name: Test
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 28
script: |
cd examples/cordova
yarn test
# pnpm test
test-ios:
name: iOS on ${{ matrix.os }}
Expand All @@ -154,65 +134,53 @@ jobs:
os: [macos-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: pnpm

- name: Restore Node cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
yarn.lock
.yarn
node_modules
*/node_modules
*/*/node_modules
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/package.json') }}-${{ secrets.CACHE_VERSION }}

- name: Config Yarn
run: |
yarn set version berry
yarn set version from sources
yarn config set enableImmutableInstalls false
yarn config set pnpFallbackMode all
yarn config set pnpMode loose
- name: Install dependencies
run: |
yarn
yarn prepare
yarn workspace '@admob-plus-internal/cli' prepack
yarn workspace '@admob-plus-internal/rollup-config' prepack
pnpm i
pushd examples/cordova
yarn prepare
yarn example cordova platform rm android
pnpm cordova prepare
pnpm cordova platform rm android
popd
pushd examples/ionic3
touch yarn.lock
yarn
pnpm i
popd
- name: Test
run: |
yarn test-ios
pnpm test-ios
pushd examples/cordova
yarn test:ios
# pnpm test:ios
popd
pushd examples/ionic3
yarn build --prod
pnpm build --prod
popd
link-checker:
name: Check links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: lychee Link Checker
id: lc
uses: lycheeverse/lychee-action@v1
uses: lycheeverse/lychee-action@v1.8.0
with:
args: >
README.md
Expand All @@ -228,19 +196,13 @@ jobs:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2

- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '16.x'

- name: Config Yarn
run: |
yarn set version berry
yarn set version from sources
yarn config set enableImmutableInstalls false
yarn config set pnpFallbackMode all
yarn config set pnpMode loose
node-version: '18.x'
cache: pnpm

- uses: webfactory/ssh-agent@v0.5.4
with:
Expand All @@ -251,9 +213,7 @@ jobs:
git config --global user.name "${GIT_USER}"
git config --global user.email "${{ secrets.GH_EMAIL }}"
pushd website
yarn
yarn workspace 'admob-plus-cordova' build
yarn deploy
pnpm deploy
popd
env:
GIT_USER: "${{ secrets.GH_NAME }}"
Expand All @@ -269,12 +229,6 @@ jobs:
--config lychee.toml
fail: true

- name: Archive yarn.lock
uses: actions/upload-artifact@v2
with:
name: yarn.lock
path: yarn.lock

- uses: hkusu/status-create-action@v1
id: status-create
with:
Expand Down
1 change: 1 addition & 0 deletions examples/cordova/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"devDependencies": {
"@admob-plus-internal/cli": "file:../../internal/cli",
"@types/cordova": "^0.0.34",
"@types/fs-extra": "^9.0.13",
"admob-plus": "../../packages/cli",
"appium": "^1.22.3",
"appium-android-driver": "^5.7.2",
Expand Down
2 changes: 0 additions & 2 deletions lychee.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
verbose = true

max-concurrency = 8

exclude = [
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"private": true,
"scripts": {
"postinstall": "is-ci || lefthook install",
"prepare": "pnpm nx -- build .",
"prepublishOnly": "pnpm nx -- clean .",
"prepare": "npx nx build .",
"prepublishOnly": "npx nx clean .",
"clean": "del '*.tsbuildinfo' 'packages/*/*.tsbuildinfo'",
"test": "nx test .",
"fmt": "cordova-plus fmt examples/{cordova,cordova-consent,ionic-angular,ionic3,playground}",
Expand All @@ -26,6 +26,7 @@
"@commitlint/prompt-cli": "^17.6.3",
"@evilmartians/lefthook": "^1.4.0",
"@ionic-native/admob-plus": "^5.36.0",
"@jest/globals": "^29.5.0",
"@nrwl/jest": "16.2.1",
"@nrwl/node": "16.2.1",
"@nrwl/workspace": "16.2.1",
Expand Down
Loading

0 comments on commit 2aff792

Please sign in to comment.