Skip to content

Commit

Permalink
task: Yarn v4 (#7345)
Browse files Browse the repository at this point in the history
Trying again, this time with correct .gitignore already setup, and a
workflow configured to try what was failing prior to our revert.
  • Loading branch information
chriswk authored Jun 12, 2024
1 parent 4c4d6e8 commit a971c77
Show file tree
Hide file tree
Showing 38 changed files with 46,799 additions and 30,965 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
!README.md
!frontend
frontend/node_modules
!.yarn/**
!.yarnrc.yml
!frontend/.yarn/**
node_modules
4 changes: 3 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ jobs:
with:
node-version: 20.x
cache: 'yarn'
- run: yarn install --frozen-lockfile --ignore-scripts
- run: yarn install --immutable
env:
YARN_ENABLE_SCRIPTS: false
- run: yarn lint
- run: yarn build:backend
- run: yarn run test:report # This adds test results as github check to the workflow
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/build_docker_prs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: PR -> Docker build

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ 20.14.0-alpine ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup QEmu
uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta configuration
uses: docker/metadata-action@v5
id: meta
with:
images: |
unleashorg/unleash-server
tags: |
# only enabled for workflow dispatch except main (assume its a release):
type=semver,pattern={{ version }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }}
type=semver,pattern={{ major }}.{{ minor }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }}
type=semver,pattern={{ major }},enable=${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main' }},value=${{ inputs.version }}
# only enabled in main:
type=edge,prefix=main-,suffix=-${{ matrix.version }},enable=${{ github.ref == 'refs/heads/main' }}
# only enabled on workflow_dispatch:
type=sha,suffix=-${{ matrix.version }},enable=${{ github.event_name == 'workflow_dispatch' }}
- name: Login to docker hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build tag and push image to Docker hub
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: NODE_VERSION=${{ matrix.version }}
2 changes: 1 addition & 1 deletion .github/workflows/build_frontend_prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20.x
- run: yarn --immutable
- run: yarn run lint:material:icons
- run: yarn --frozen-lockfile
- run: yarn run lint:check
- run: yarn run test
- run: yarn run ts:check # TODO: optimize
6 changes: 1 addition & 5 deletions .github/workflows/docker_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [20.13.1-alpine]
version: [ 20.14.0-alpine ]
steps:
- name: Checkout tag v${{ inputs.version }}
if: ${{ inputs.version != '' }}
Expand Down Expand Up @@ -53,10 +53,6 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build frontend
run: |
yarn --cwd ./frontend install
yarn build:frontend
- name: Build tag and push image to Docker hub
uses: docker/build-push-action@v5
with:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/e2e.frontend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Run Cypress
uses: cypress-io/github-action@v5
uses: cypress-io/github-action@v6
with:
working-directory: frontend
env: AUTH_USER=admin,AUTH_PASSWORD=unleash4all
config: baseUrl=${{ github.event.deployment_status.target_url }}
spec: cypress/integration/${{ matrix.test }}
install-command: yarn --immutable
4 changes: 2 additions & 2 deletions .github/workflows/gradual-strict-null-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ jobs:
YARN_1="yarn --mutex network --cwd ./current"
YARN_2="yarn --mutex network --cwd ./main"
$YARN_1 install --ignore-scripts &> /dev/null && $YARN_1 build:backend --strictNullChecks true 2> .stderr-current > .out-current &
$YARN_1 install &> /dev/null && $YARN_1 build:backend --strictNullChecks true 2> .stderr-current > .out-current &
pid1=$!
$YARN_2 install --ignore-scripts &> /dev/null && $YARN_2 build:backend --strictNullChecks true 2> .stderr-main > .out-main &
$YARN_2 install &> /dev/null && $YARN_2 build:backend --strictNullChecks true 2> .stderr-main > .out-main &
pid2=$!
# wait for the processes that are expected to fail
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/notify_enterprise.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'yarn'
- name: Trigger sync
uses: actions/github-script@v7
env:
Expand All @@ -42,7 +43,7 @@ jobs:
- name: Build static assets
run: |
cd frontend
yarn install --frozen-lockfile
yarn install --immutable
yarn build
- uses: aws-actions/configure-aws-credentials@v2
with:
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/publish-new-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ concurrency:

permissions:
contents: write
id-token: write
id-token: write

on:
workflow_dispatch:
Expand All @@ -30,7 +30,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [ 20.x ]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -66,10 +66,12 @@ jobs:
else
echo "No changes to CHANGELOG.md"
fi
- run: yarn install --frozen-lockfile --ignore-scripts
- run: yarn install --immutable
env:
YARN_ENABLE_SCRIPTS: false
- name: npm version
run: |
npm version ${{ github.event.inputs.version }} --ignore-scripts
npm version ${{ github.event.inputs.version }}
git push origin ${{ github.ref_name }}
git push --tags
env:
Expand Down Expand Up @@ -104,8 +106,10 @@ jobs:
run: git checkout origin/${{ github.ref_name }} -- CHANGELOG.md
- name: lint
run: |
yarn install --frozen-lockfile --ignore-scripts
yarn install --immutable
yarn lint:fix
env:
YARN_ENABLE_SCRIPTS: false
- name: push changes
run: |
git add package.json CHANGELOG.md
Expand All @@ -118,7 +122,7 @@ jobs:
secrets: inherit
with:
version: ${{ github.event.inputs.version }}

publish-npm:
needs: build
uses: ./.github/workflows/release.yaml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
cache: 'yarn'
- name: Build
run: |
yarn install --frozen-lockfile
yarn install --immutable
- name: Publish to npm
run: |
LATEST=$(npm show unleash-server version)
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/validate-migrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'yarn'
node-version: 20.x
cache: 'yarn'
- name: Start database
working-directory: test-migrations
run: docker compose up db -d --wait -t 90
Expand All @@ -29,16 +29,18 @@ jobs:
# add some data with terraform
- name: Apply migrations
env:
DATABASE_URL: postgres://postgres:unleash@localhost:5432/unleash
DATABASE_SSL: false
DATABASE_URL: postgres://postgres:unleash@localhost:5432/unleash
DATABASE_SSL: false
YARN_ENABLE_SCRIPTS: false
run: |
yarn install --frozen-lockfile --ignore-scripts
yarn install --immutable
yarn db-migrate up
# run ui tests against previous version of Unleash
- name: Run Cypress
uses: cypress-io/github-action@v5
uses: cypress-io/github-action@v6
with:
working-directory: frontend
env: AUTH_USER=admin,AUTH_PASSWORD=unleash4all
config: baseUrl=http://localhost:4242
spec: cypress/oss/**/*.spec.ts
install-command: yarn --immutable
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,24 @@ reports/jest-junit.xml
!.yarn/releases
!.yarn/sdks
!.yarn/versions
frontend/.yarn/*
!frontend/.yarn/patches
!frontend/.yarn/plugins
!frontend/.yarn/releases
!frontend/.yarn/sdks
!frontend/.yarn/versions

docker/.yarn/*
!docker/.yarn/patches
!docker/.yarn/plugins
!docker/.yarn/releases
!docker/.yarn/sdks
!docker/.yarn/versions

website/.yarn/*
!website/.yarn/patches
!website/.yarn/plugins
!website/.yarn/releases
!website/.yarn/sdks
!website/.yarn/versions

2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
yarn dlx lint-staged

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

Expand Down
Loading

0 comments on commit a971c77

Please sign in to comment.