Upgrade @eclipse-che/che-devworkspace-generator and @devfile/api #2760
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright (c) 2020-2024 Red Hat, Inc. | |
# This program and the accompanying materials are made | |
# available under the terms of the Eclipse Public License 2.0 | |
# which is available at https://www.eclipse.org/legal/epl-2.0/ | |
# | |
# SPDX-License-Identifier: EPL-2.0 | |
# | |
name: PR | |
on: | |
pull_request: | |
branches: ['*'] | |
env: | |
DIR_DASHBOARD: che-dashboard | |
DIR_CHE: che | |
IMAGE_VERSION: pr-${{ github.event.pull_request.number }} | |
ORGANIZATION: quay.io/eclipse | |
jobs: | |
dash-licenses: | |
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: "Install dependencies" | |
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: scripts/yarn/change_package_manager.sh | |
- | |
name: "Install dependencies" | |
run: yarn | |
- | |
name: "Check dependencies usage restrictions" | |
run: yarn license:check | |
time-check: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
node-version: [18.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: "Install dependencies" | |
run: yarn | |
- | |
name: "Workspace creation time check" | |
run: yarn test:check | |
build-and-test: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
node-version: [18.x, 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: "Install dependencies" | |
run: yarn | |
- | |
name: "Build" | |
run: yarn build | |
- | |
name: "Run linters" | |
run: yarn lint:check | |
- | |
name: "Run unit tests" | |
run: yarn test | |
build-and-test-yarn-v1: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
node-version: [18.x, 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: scripts/yarn/change_package_manager.sh | |
- | |
name: "Install dependencies" | |
run: yarn | |
- | |
name: "Build" | |
run: yarn build | |
- | |
name: "Run linters" | |
run: yarn lint:check | |
- | |
name: "Run unit tests" | |
run: yarn test | |
docker-build: | |
needs: build-and-test | |
runs-on: ubuntu-22.04 | |
continue-on-error: ${{ matrix.default == false }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [linux/amd64] | |
default: [true] | |
include: | |
- platform: linux/arm64 | |
default: false | |
steps: | |
- | |
name: "Checkout Che Dashboard source code" | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.DIR_DASHBOARD }} | |
ref: ${{ github.event.pull_request.head.sha }} | |
- | |
name: "Set up QEMU" | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: "Set up Docker Buildx ${{ matrix.platform }}" | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: "Cache Docker layers" | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- | |
name: "Docker quay.io Login" | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- | |
name: "Build and push ${{ matrix.platform }}" | |
uses: docker/build-push-action@v5 | |
with: | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
context: ./${{ env.DIR_DASHBOARD }} | |
file: ./${{ env.DIR_DASHBOARD }}/build/dockerfiles/Dockerfile | |
platforms: ${{ matrix.platform }} | |
push: ${{ matrix.default == true }} | |
provenance: false | |
tags: ${{ env.ORGANIZATION }}/che-dashboard:${{ env.IMAGE_VERSION }} | |
- | |
name: "Comment with image name" | |
uses: actions/github-script@v7 | |
if: ${{ matrix.default == true }} | |
with: | |
script: | | |
const { issue: { number: issue_number }, repo: { owner, repo } } = context; | |
const dashboardImage = "${{ env.ORGANIZATION }}/che-dashboard:${{ env.IMAGE_VERSION }}"; | |
const patchCommand = `kubectl patch -n eclipse-che "checluster/eclipse-che" --type=json -p="[{\"op\": \"replace\", \"path\": \"/spec/components/dashboard/deployment\", \"value\": {containers: [{image: \"${dashboardImage}\", name: che-dashboard}]}}]"`; | |
const text = ` | |
Docker image build succeeded: **${dashboardImage}** | |
<details> | |
<summary>kubectl patch command</summary> | |
\`\`\`bash | |
${patchCommand} | |
\`\`\` | |
</details> | |
`; | |
github.rest.issues.createComment({ issue_number, owner, repo, body: text }); |