Skip to content

Commit f4e3388

Browse files
task: Yarn v4 (#7457)
Moves to Yarn v4 --------- Co-authored-by: Alvin Bryan <[email protected]>
1 parent 82822a7 commit f4e3388

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+46719
-30937
lines changed

.dockerignore

+4
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@
1111
!README.md
1212
!frontend
1313
frontend/node_modules
14+
!.yarn/**
15+
!.yarnrc.yml
16+
!frontend/.yarn/**
17+
node_modules

.github/workflows/build.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ jobs:
4040
with:
4141
node-version: 20.x
4242
cache: 'yarn'
43-
- run: yarn install --frozen-lockfile --ignore-scripts
43+
- name: Enable corepack
44+
run: corepack enable
45+
- run: yarn install --immutable
46+
env:
47+
YARN_ENABLE_SCRIPTS: false
4448
- run: yarn lint
4549
- run: yarn build:backend
4650
- run: yarn run test:report # This adds test results as github check to the workflow

.github/workflows/build_coverage.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ jobs:
3939
with:
4040
node-version: 20.x
4141
cache: 'yarn'
42+
- name: Enable corepack
43+
run: corepack enable
4244
- run: yarn
4345
- run: yarn build:frontend:if-needed
4446
- run: yarn run test:coverage
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: PR -> Docker build
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
version: [ 20.14.0-alpine ]
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
- name: Setup QEmu
16+
uses: docker/setup-qemu-action@v3
17+
- name: Setup Docker buildx
18+
uses: docker/setup-buildx-action@v3
19+
- name: Docker meta configuration
20+
uses: docker/metadata-action@v5
21+
id: meta
22+
with:
23+
images: |
24+
unleashorg/unleash-server
25+
tags: |
26+
# only enabled for workflow dispatch except main (assume its a release):
27+
type=semver,pattern={{ version }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }}
28+
type=semver,pattern={{ major }}.{{ minor }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }}
29+
type=semver,pattern={{ major }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }}
30+
# only enabled in main:
31+
type=edge,prefix=main-,suffix=-${{ matrix.version }},enable=${{ github.ref == 'refs/heads/main' }}
32+
# only enabled on workflow_dispatch:
33+
type=sha,suffix=-${{ matrix.version }},enable=${{ github.event_name == 'workflow_dispatch' }}
34+
- name: Login to docker hub
35+
uses: docker/login-action@v3
36+
with:
37+
username: ${{ secrets.DOCKERHUB_USERNAME }}
38+
password: ${{ secrets.DOCKERHUB_TOKEN }}
39+
- name: Build tag and push image to Docker hub
40+
uses: docker/build-push-action@v5
41+
with:
42+
context: .
43+
platforms: linux/amd64,linux/arm64
44+
push: false
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}
47+
build-args: NODE_VERSION=${{ matrix.version }}

.github/workflows/build_frontend_prs.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ jobs:
1919
uses: actions/setup-node@v4
2020
with:
2121
node-version: 20.x
22+
- name: Enable corepack
23+
run: corepack enable
24+
- run: yarn --immutable
2225
- run: yarn run lint:material:icons
23-
- run: yarn --frozen-lockfile
2426
- run: yarn run lint:check
2527
- run: yarn run test
2628
- run: yarn run ts:check # TODO: optimize

.github/workflows/build_prs_jest_report.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
with:
3838
node-version: 20.x
3939
cache: 'yarn'
40+
- name: Enable corepack
41+
run: corepack enable
4042
- name: Tests on 20.x
4143
id: coverage
4244
uses: ArtiomTr/jest-coverage-report-action@v2

.github/workflows/docker_publish.yaml

+1-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
version: [20.13.1-alpine]
22+
version: [ 20.14.0-alpine ]
2323
steps:
2424
- name: Checkout tag v${{ inputs.version }}
2525
if: ${{ inputs.version != '' }}
@@ -53,10 +53,6 @@ jobs:
5353
with:
5454
username: ${{ secrets.DOCKERHUB_USERNAME }}
5555
password: ${{ secrets.DOCKERHUB_TOKEN }}
56-
- name: Build frontend
57-
run: |
58-
yarn --cwd ./frontend install
59-
yarn build:frontend
6056
- name: Build tag and push image to Docker hub
6157
uses: docker/build-push-action@v5
6258
with:

.github/workflows/e2e.frontend.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ jobs:
2020
- name: Checkout
2121
uses: actions/checkout@v4
2222
- name: Run Cypress
23-
uses: cypress-io/github-action@v5
23+
uses: cypress-io/github-action@v6
2424
with:
2525
working-directory: frontend
2626
env: AUTH_USER=admin,AUTH_PASSWORD=unleash4all
2727
config: baseUrl=${{ github.event.deployment_status.target_url }}
2828
spec: cypress/integration/${{ matrix.test }}
29+
install-command: yarn --immutable

.github/workflows/gradual-strict-null-checks.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ jobs:
3535
cache-dependency-path: |
3636
current/yarn.lock
3737
main/yarn.lock
38+
- name: Enable corepack
39+
run: corepack enable
3840
- name: Compare errors if enabling strictNullChecks
3941
env:
4042
URL: ${{ github.event.pull_request.comments_url }}
@@ -50,9 +52,9 @@ jobs:
5052
YARN_1="yarn --mutex network --cwd ./current"
5153
YARN_2="yarn --mutex network --cwd ./main"
5254
53-
$YARN_1 install --ignore-scripts &> /dev/null && $YARN_1 build:backend --strictNullChecks true 2> .stderr-current > .out-current &
55+
$YARN_1 install &> /dev/null && $YARN_1 build:backend --strictNullChecks true 2> .stderr-current > .out-current &
5456
pid1=$!
55-
$YARN_2 install --ignore-scripts &> /dev/null && $YARN_2 build:backend --strictNullChecks true 2> .stderr-main > .out-main &
57+
$YARN_2 install &> /dev/null && $YARN_2 build:backend --strictNullChecks true 2> .stderr-main > .out-main &
5658
pid2=$!
5759
5860
# wait for the processes that are expected to fail

.github/workflows/notify_enterprise.yaml

+8-5
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414

15-
strategy:
16-
matrix:
17-
node-version: [20.x]
18-
1915
steps:
2016
- uses: actions/checkout@v4
17+
- name: Use Node.js 20
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20.x
21+
cache: 'yarn'
22+
- name: Enable corepack
23+
run: corepack enable
2124
- name: Trigger sync
2225
uses: actions/github-script@v7
2326
env:
@@ -42,7 +45,7 @@ jobs:
4245
- name: Build static assets
4346
run: |
4447
cd frontend
45-
yarn install --frozen-lockfile
48+
yarn install --immutable
4649
yarn build
4750
- uses: aws-actions/configure-aws-credentials@v2
4851
with:

.github/workflows/publish-new-version.yaml

+10-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ concurrency:
66

77
permissions:
88
contents: write
9-
id-token: write
9+
id-token: write
1010

1111
on:
1212
workflow_dispatch:
@@ -30,7 +30,7 @@ jobs:
3030

3131
strategy:
3232
matrix:
33-
node-version: [20.x]
33+
node-version: [ 20.x ]
3434

3535
steps:
3636
- uses: actions/checkout@v4
@@ -66,10 +66,12 @@ jobs:
6666
else
6767
echo "No changes to CHANGELOG.md"
6868
fi
69-
- run: yarn install --frozen-lockfile --ignore-scripts
69+
- run: yarn install --immutable
70+
env:
71+
YARN_ENABLE_SCRIPTS: false
7072
- name: npm version
7173
run: |
72-
npm version ${{ github.event.inputs.version }} --ignore-scripts
74+
npm version ${{ github.event.inputs.version }}
7375
git push origin ${{ github.ref_name }}
7476
git push --tags
7577
env:
@@ -104,8 +106,10 @@ jobs:
104106
run: git checkout origin/${{ github.ref_name }} -- CHANGELOG.md
105107
- name: lint
106108
run: |
107-
yarn install --frozen-lockfile --ignore-scripts
109+
yarn install --immutable
108110
yarn lint:fix
111+
env:
112+
YARN_ENABLE_SCRIPTS: false
109113
- name: push changes
110114
run: |
111115
git add package.json CHANGELOG.md
@@ -118,7 +122,7 @@ jobs:
118122
secrets: inherit
119123
with:
120124
version: ${{ github.event.inputs.version }}
121-
125+
122126
publish-npm:
123127
needs: build
124128
uses: ./.github/workflows/release.yaml

.github/workflows/release.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ jobs:
2525
node-version: 20.x
2626
registry-url: 'https://registry.npmjs.org'
2727
cache: 'yarn'
28+
- name: Enable corepack
29+
run: corepack enable
2830
- name: Build
2931
run: |
30-
yarn install --frozen-lockfile
32+
yarn install --immutable
3133
- name: Publish to npm
3234
run: |
3335
LATEST=$(npm show unleash-server version)

.github/workflows/validate-migrations.yaml

+8-6
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
- name: Use Node.js 20.x
1919
uses: actions/setup-node@v4
2020
with:
21-
node-version: 20.x
22-
cache: 'yarn'
21+
node-version: 20.x
22+
cache: 'yarn'
2323
- name: Start database
2424
working-directory: test-migrations
2525
run: docker compose up db -d --wait -t 90
@@ -29,16 +29,18 @@ jobs:
2929
# add some data with terraform
3030
- name: Apply migrations
3131
env:
32-
DATABASE_URL: postgres://postgres:unleash@localhost:5432/unleash
33-
DATABASE_SSL: false
32+
DATABASE_URL: postgres://postgres:unleash@localhost:5432/unleash
33+
DATABASE_SSL: false
34+
YARN_ENABLE_SCRIPTS: false
3435
run: |
35-
yarn install --frozen-lockfile --ignore-scripts
36+
yarn install --immutable
3637
yarn db-migrate up
3738
# run ui tests against previous version of Unleash
3839
- name: Run Cypress
39-
uses: cypress-io/github-action@v5
40+
uses: cypress-io/github-action@v6
4041
with:
4142
working-directory: frontend
4243
env: AUTH_USER=admin,AUTH_PASSWORD=unleash4all
4344
config: baseUrl=http://localhost:4242
4445
spec: cypress/oss/**/*.spec.ts
46+
install-command: yarn --immutable

.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,24 @@ reports/jest-junit.xml
7070
!.yarn/releases
7171
!.yarn/sdks
7272
!.yarn/versions
73+
frontend/.yarn/*
74+
!frontend/.yarn/patches
75+
!frontend/.yarn/plugins
76+
!frontend/.yarn/releases
77+
!frontend/.yarn/sdks
78+
!frontend/.yarn/versions
79+
80+
docker/.yarn/*
81+
!docker/.yarn/patches
82+
!docker/.yarn/plugins
83+
!docker/.yarn/releases
84+
!docker/.yarn/sdks
85+
!docker/.yarn/versions
86+
87+
website/.yarn/*
88+
!website/.yarn/patches
89+
!website/.yarn/plugins
90+
!website/.yarn/releases
91+
!website/.yarn/sdks
92+
!website/.yarn/versions
93+

.husky/pre-commit

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
npx lint-staged
4+
yarn dlx lint-staged
55

66
node .husky/update-openapi-spec-list.js
77

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**.test.js

0 commit comments

Comments
 (0)