Skip to content

Commit

Permalink
chore(workflow): add a new workflow containing all checks (#145)
Browse files Browse the repository at this point in the history
* chore(workflow): add a new workflow containing all checks

* chore(workflow): do not shre node_modules between jobs

* chore(workflow): build packages before testing

* chore(workflow): add a workflow for publishing

* chore(workflow): remove obsolete workflows

* chore(workflow): remove automatic application of license check

* chore(workflow) do not use parallel while testing

* chore(workflow) do not use run with npx for licenses

* chore(workflow) add new line to release.yaml

* chore(workflow) add format check to ci workflow
  • Loading branch information
andypf authored Jul 26, 2024
1 parent c1bf497 commit d3dd6f7
Show file tree
Hide file tree
Showing 15 changed files with 685 additions and 3,208 deletions.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,

* @cloudoperators/greenhouse-frontend
/packages/ui-components/ @cloudoperators/greenhouse-frontend @franzheidl
* @cloudoperators/frontend-core
/packages/ui-components/ @cloudoperators/frontend-core @franzheidl
146 changes: 146 additions & 0 deletions .github/workflows/ci-checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: CI Check

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
install-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Specify the node version you need

- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

reuse-compliance:
runs-on: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4

# https://github.com/fsfe/reuse-action
- name: REUSE Compliance Check
uses: fsfe/reuse-action@v3

license-headers:
runs-on: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Check License Header
uses: apache/skywalking-eyes/[email protected]
with:
config: .github/licenserc.yaml
mode: fix

allowed-licenses:
needs: install-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Specify the node version you need

- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci

- name: Run Linter
run: npm run check-licenses

lint:
needs: install-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Specify the node version you need

- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci
- name: Run Linter
run: npm run lint

format:
needs: install-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Specify the node version you need

- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci
- name: Run Prettier
run: npm run check-format

test:
needs: install-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Specify the node version you need

- name: Cache npm
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install Dependencies
run: npm ci && npm run build
- name: Run Tests
run: npm run test

28 changes: 0 additions & 28 deletions .github/workflows/eslint.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/license-checker.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/license-header.yaml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install Dependencies
run: npm ci

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

16 changes: 0 additions & 16 deletions .github/workflows/reuse.yaml

This file was deleted.

22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,28 @@ The following rule governs code contributions:
- Contributions must be licensed under the [Apache 2.0 License](./LICENSE)
- Due to legal reasons, contributors will be asked to accept a Developer Certificate of Origin (DCO) when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses [the standard DCO text of the Linux Foundation](https://developercertificate.org/).

## License Header

Please include the following license header at the top of every source file:

```plaintext
/*
* SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Juno contributors
* SPDX-License-Identifier: Apache-2.0
*/
```

## Checks

Before submitting your pull request, please ensure your code passes the following checks. These checks are also run in the CI workflow for every PR:

- **Linting**: Make sure your code adheres to the project’s coding standards by running `npm run lint`.
- **Prettier**: Ensure your code is properly formatted by running `npm run check-format`.
- **License Header**: Verify that every source file includes the correct license header as specified above.
- **Allowed Licenses**: Ensure that any dependencies added are compliant with the list of allowed licenses (see in `package.json`). Check with `npm run check-licenses`.
- **REUSE Compliance**: Ensure that your contributions are compliant with the [REUSE guidelines](./reuse/dep5).
- **Tests**: Make sure all tests pass. Run `npm run test` at the root level to ensure your code didn't break other packages.

## Issues and Planning

- We use GitHub issues to track bugs and enhancement requests.
Expand Down
11 changes: 3 additions & 8 deletions apps/example/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@
"extends": ["//"],
"tasks": {
"dev": {
"dependsOn": [
"@cloudoperators/juno-ui-components#build",
"@cloudoperators/juno-messages-provider#build"
]
"dependsOn": ["@cloudoperators/juno-ui-components#build", "@cloudoperators/juno-messages-provider#build"]
},
"build": {
"dependsOn": [
"@cloudoperators/juno-ui-components#build",
"@cloudoperators/juno-messages-provider#build"
"@cloudoperators/juno-messages-provider#build",
"@cloudoperators/juno-communicator#build"
]
},
"test": {
"dependsOn": ["build"]
}
}
}
Loading

0 comments on commit d3dd6f7

Please sign in to comment.