Skip to content

Commit

Permalink
fix: PR workflows
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Orel <[email protected]>
  • Loading branch information
olexii4 committed Sep 18, 2024
1 parent e1fe428 commit 9839329
Show file tree
Hide file tree
Showing 5 changed files with 801 additions and 492 deletions.
60 changes: 59 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,33 @@ jobs:
node-version: 18
-
name: "Install dependencies"
run: yarn
run: yarn install
-
name: "Check dependencies usage restrictions"
run: yarn license:check

dash-licenses-yarn-v1:
runs-on: ubuntu-22.04
if: ${{ github.base_ref == 'main' }}
steps:
-
name: "Checkout Che Dashboard source code"
uses: actions/checkout@v4
-
name: "Use Node 20"
uses: actions/setup-node@v4
with:
node-version: 20
-
name: "Switch to Yarn 1"
run: npm run changePackageMenedgerVersion
-
name: "Install dependencies"
run: yarn
-
name: "Check dependencies usage restrictions"
run: podman run --rm -t -v ./:/workspace/project quay.io/che-incubator/dash-licenses:next --check

time-check:
runs-on: ubuntu-22.04
strategy:
Expand Down Expand Up @@ -88,6 +110,42 @@ jobs:
name: "Run unit tests"
run: yarn test

build-and-test-yarn-v1:
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20.x]
steps:
-
name: "Checkout Che Dashboard source code"
uses: actions/checkout@v4
-
name: "Use Node.js ${{ matrix.node-version }}"
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
-
name: "Switch to Yarn 1"
run: npm run changePackageMenedgerVersion
-
name: "Install dependencies"
run: yarn
-
name: "Build common"
run: yarn --cwd packages/common build
-
name: "Build frontend"
run: yarn --cwd packages/dashboard-frontend build
-
name: "Test frontend"
run: yarn --cwd packages/dashboard-frontend test
-
name: "Build backend"
run: yarn --cwd packages/dashboard-backend build
-
name: "Test backend"
run: yarn --cwd packages/dashboard-backend test

docker-build:
needs: build-and-test
runs-on: ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"start": "${PWD}/run/local-run.sh $@",
"start:prepare": "${PWD}/run/prepare-local-run.sh",
"start:cleanup": "${PWD}/run/revert-local-run.sh",
"changePackageMenedgerVersion": "${PWD}/scripts/yarn/change_package_manager.sh $@",
"license:check": "${PWD}/scripts/container_tool.sh run --rm -t -v ${PWD}/:/workspace/project quay.io/che-incubator/dash-licenses:next --check",
"license:generate": "${PWD}/scripts/container_tool.sh run --rm -t -v ${PWD}/:/workspace/project quay.io/che-incubator/dash-licenses:next",
"test": "yarn run pretest && lerna run test --stream -- --no-cache $@",
Expand Down
12 changes: 7 additions & 5 deletions scripts/yarn/change_package_manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

# The script is used to change current package manager(yarn 1 vs yarn 3)

export OLD_VERSION_DIR=$(pwd)/scripts/yarn/old_version
export TMP_DIR=$(pwd)/scripts/yarn/tmp
OLD_VERSION_DIR=$(pwd)/scripts/yarn/old_version
TMP_DIR=$(pwd)/scripts/yarn/tmp

#==========================Clean temporary directory============================
if [ -d $TMP_DIR ]; then
echo "[INFO]: Clean temporary directory"
rm -rf $(pwd)/scripts/yarn/tmp
rm -rf $TMP_DIR
else
echo "[INFO]: Create temporary directory"
fi
Expand Down Expand Up @@ -49,14 +49,16 @@ fi
#==========================Restore old version=================================
if [ -d $OLD_VERSION_DIR ]; then
echo "[INFO]: Restore old package manager version"
mv -f $OLD_VERSION_DIR/{*,.*} $(pwd)/ > /dev/null 2>&1
mv -f $OLD_VERSION_DIR/{*,.yarn*,.deps*} $(pwd)/
fi
#==========================Cleanup=============================================
if [ -d $TMP_DIR ]; then
echo "[INFO]: Cleanup"
mv -f $TMP_DIR/{*,.*} $OLD_VERSION_DIR/ > /dev/null 2>&1
mv -f $TMP_DIR/{*,.yarn*,.deps*} $OLD_VERSION_DIR/
rm -d $TMP_DIR
fi

#==========================Check current version================================
VER=$(yarn --cwd $(pwd) -v | sed -e s/\\./\\n/g | sed -n 1p)

echo
Expand Down
Loading

0 comments on commit 9839329

Please sign in to comment.