Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI checks on PRs #9064

Merged
merged 5 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 44 additions & 21 deletions .github/workflows/build_and_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ jobs:
disk-root: 'C:'

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup JDK (Windows only)
if: matrix.os == 'windows-latest'
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -88,7 +88,7 @@ jobs:
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV

- name: Initialize Yarn Cache
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os != 'windows-latest'
with:
path: ${{ env.YARN_CACHE_LOCATION }}
Expand Down Expand Up @@ -133,10 +133,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -151,7 +151,7 @@ jobs:
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV

- name: Initialize Yarn Cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ env.YARN_CACHE_LOCATION }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
Expand All @@ -161,6 +161,25 @@ jobs:
- name: Run bootstrap
run: yarn osd bootstrap

- name: Check for yarn.lock changes
run: |
if [[ `git status --porcelain yarn.lock` ]]; then
echo -e "\033[31mThe yarn.lock file is out of sync!\033[0m"
git diff
exit 1
fi

- name: Generate dev docs
run: yarn docs:generateDevDocs

- name: Check for dev docs changes
run: |
if [[ `git status --porcelain docs/_sidebar.md` ]]; then
echo -e "\033[31mThe dev docs are out of sync; run yarn docs:generateDevDocs and amend the PR.\033[0m"
git diff
exit 1
fi

- name: Run linter
id: linter
run: yarn lint
Expand All @@ -169,6 +188,10 @@ jobs:
id: notice-validate
run: yarn notice:validate

- name: Validate licenses
id: i18n-licenses
run: yarn checkLicenses

- name: Check i18n
id: i18n-check
run: yarn i18n:check
Expand Down Expand Up @@ -203,17 +226,17 @@ jobs:
disk-root: 'C:'

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup JDK (Windows only)
if: matrix.os == 'windows-latest'
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -229,7 +252,7 @@ jobs:
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV

- name: Initialize Yarn Cache
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os != 'windows-latest'
with:
path: ${{ env.YARN_CACHE_LOCATION }}
Expand Down Expand Up @@ -319,17 +342,17 @@ jobs:
disk-root: 'C:'

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup JDK (Windows only)
if: matrix.os == 'windows-latest'
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -345,7 +368,7 @@ jobs:
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV

- name: Initialize Yarn Cache
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os != 'windows-latest'
with:
path: ${{ env.YARN_CACHE_LOCATION }}
Expand Down Expand Up @@ -451,12 +474,12 @@ jobs:
disk-root: 'C:'

- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ./artifacts

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: './artifacts/.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -472,7 +495,7 @@ jobs:
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV

- name: Initialize Yarn Cache
uses: actions/cache@v3
uses: actions/cache@v4
if: matrix.os != 'windows-latest'
with:
path: ${{ env.YARN_CACHE_LOCATION }}
Expand Down Expand Up @@ -540,15 +563,15 @@ jobs:
]
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ./artifacts

- run: echo Running backwards compatibility tests for version ${{ matrix.version }}
- run: echo [NOTE] These tests will be ran using Linux x64 release builds without security

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: './artifacts/.nvmrc'
registry-url: 'https://registry.npmjs.org'
Expand Down Expand Up @@ -583,7 +606,7 @@ jobs:
run: echo "BWC_VERSIONS=${{ matrix.version }}" >> $GITHUB_ENV

- name: Download OpenSearch Dashboards
uses: actions/download-artifact@v4.1.7
uses: actions/download-artifact@v4
id: download
with:
name: linux-x64-${{ env.VERSION }}
Expand Down
9 changes: 9 additions & 0 deletions changelogs/fragments/9064.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
infra:
- Add checks for out of sync lockfile and dev docc to the CI ([#9064](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9064))
- Validate the licensing imposed by dependencies during CI ([#9064](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9064))

chore:
- Bump actions used by build and test workflows ([#9064](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9064))

feat:
- Improve validation of the licensing imposed by dependencies. ([#9064](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9064))
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
- [Opensearch dashboards.release notes 1.3.17](../release-notes/opensearch-dashboards.release-notes-1.3.17.md)
- [Opensearch dashboards.release notes 1.3.19](../release-notes/opensearch-dashboards.release-notes-1.3.19.md)
- [Opensearch dashboards.release notes 1.3.2](../release-notes/opensearch-dashboards.release-notes-1.3.2.md)
- [Opensearch dashboards.release notes 1.3.20](../release-notes/opensearch-dashboards.release-notes-1.3.20.md)
- [Opensearch dashboards.release notes 1.3.3](../release-notes/opensearch-dashboards.release-notes-1.3.3.md)
- [Opensearch dashboards.release notes 1.3.5](../release-notes/opensearch-dashboards.release-notes-1.3.5.md)
- [Opensearch dashboards.release notes 1.3.6](../release-notes/opensearch-dashboards.release-notes-1.3.6.md)
Expand Down
38 changes: 21 additions & 17 deletions src/dev/license_checker/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,39 @@
* under the License.
*/

// ToDo: Make an allow-list for packages with licenses that require attribution so
// they can be allowed only after attribution is added but fail before.

// The following list applies to packages both
// used as dependencies or dev dependencies
export const LICENSE_ALLOWLIST = [
'Elastic-License',
'0BSD',
'(AFL-2.1 OR BSD-3-Clause)',
'(Apache-2.0 AND BSD-3-Clause)',
'(BSD-2-Clause OR MIT OR Apache-2.0)',
'(BSD-2-Clause OR MIT)',
'(BSD-3-Clause AND Apache-2.0)',
'(BSD-3-Clause OR GPL-2.0)',
'(GPL-2.0 OR MIT)',
'(MIT AND CC-BY-3.0)',
'(MIT AND Zlib)',
'(MIT OR Apache-2.0)',
'(MIT AND BSD-3-Clause)',
'(MIT OR CC0-1.0)',
'(MIT OR GPL-3.0)',
'(WTFPL OR MIT)',
'(MPL-2.0 OR Apache-2.0)',
'(OFL-1.1 AND MIT)',
'(Unlicense OR Apache-2.0)',
'(WTFPL OR MIT)',
'0BSD',
'AFLv2.1',
'Apache 2.0',
'Apache License, v2.0',
'Apache License, Version 2.0',
'Apache License, v2.0',
'Apache',
'Apache*',
'Apache, Version 2.0',
'Apache-2.0',
'BlueOak-1.0.0',
'BSD 3-Clause',
'BSD New',
'BSD',
Expand All @@ -59,29 +69,28 @@ export const LICENSE_ALLOWLIST = [
'BSD-3-Clause AND MIT',
'BSD-3-Clause OR MIT',
'BSD-3-Clause',
'(BSD-3-Clause OR GPL-2.0)',
'BSD-like',
'CC0-1.0',
'CC-BY',
'CC-BY-3.0',
'CC-BY-4.0',
'CC0-1.0',
'Eclipse Distribution License - v 1.0',
'Elastic-License',
'FreeBSD',
'ISC',
'ISC*',
'MIT OR GPL-2.0',
'(MIT OR CC0-1.0)',
'MIT',
'MIT*',
'MIT/X11',
'new BSD, and MIT',
'(OFL-1.1 AND MIT)',
'Nuclide software',
'PSF',
'Public Domain',
'Python-2.0',
'Unlicense',
'WTFPL OR ISC',
'WTFPL',
'Nuclide software',
'new BSD, and MIT',
];

// The following list only applies to licenses that
Expand All @@ -90,12 +99,7 @@ export const DEV_ONLY_LICENSE_ALLOWLIST = ['MPL-2.0'];

// Globally overrides a license for a given package@version
export const LICENSE_OVERRIDES = {
'jsts@1.6.2': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts
'@mapbox/jsonlint-lines-primitives@2.0.2': ['MIT'], // license in readme https://github.com/tmcw/jsonlint

// TODO can be removed if the https://github.com/jindw/xmldom/issues/239 is released
'xmldom@0.1.27': ['MIT'],

// TODO can be removed once we upgrade the use of walk dependency past or equal to v2.3.14
zhongnansu marked this conversation as resolved.
Show resolved Hide resolved
'jackspeak@3.4.0': ['BlueOak-1.0.0'],
'path-scurry@1.11.1': ['BlueOak-1.0.0'],
'walk@2.3.9': ['MIT'],
};
Loading
Loading