Skip to content

Commit

Permalink
Merge pull request #1291 from cloud-pi-native/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ArnaudTA authored Aug 26, 2024
2 parents c33b555 + 3b3b051 commit 39e9093
Show file tree
Hide file tree
Showing 444 changed files with 14,131 additions and 10,924 deletions.
57 changes: 0 additions & 57 deletions .eslintignore

This file was deleted.

3 changes: 3 additions & 0 deletions .github/labeler/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
built:
- changed-files:
- any-glob-to-any-file: '**'
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:

- name: Build and push docker image
id: build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: ${{ matrix.images.build.context }}
file: ${{ matrix.images.build.dockerfile }}
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ env:
NAMESPACE: "${{ github.repository }}"
MULTI_ARCH: true
USE_QEMU: false
NODE_VERSION: "20.15.1"
PNPM_VERSION: "9.5.0"
NODE_VERSION: "20.16.0"
PNPM_VERSION: "9.7.1"

jobs:
expose-vars:
Expand Down Expand Up @@ -56,5 +56,6 @@ jobs:
PNPM_VERSION: ${{ needs.expose-vars.outputs.PNPM_VERSION }}
NODE_VERSION: ${{ needs.expose-vars.outputs.NODE_VERSION }}
PUBLISH_APPS: false
PUBLISH_PACKAGES: false
PUBLISH_PLUGINS: false
PUBLISH_PACKAGES: true
PUBLISH_PLUGINS: true
CHECK_CHANGES: false
38 changes: 33 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ on:
workflow_dispatch:

env:
NODE_VERSION: "20.15.1"
PNPM_VERSION: "9.5.0"
NODE_VERSION: "20.16.0"
PNPM_VERSION: "9.7.1"
REGISTRY: "ghcr.io"
NAMESPACE: "${{ github.repository }}"
MULTI_ARCH: false
Expand All @@ -25,6 +25,8 @@ jobs:
if: ${{ !github.event.pull_request.draft }}
outputs:
apps: ${{ steps.filter.outputs.apps }}
packages: ${{ steps.filter.outputs.packages }}
ci: ${{ steps.filter.outputs.ci }}
steps:
- name: Checks-out repository
uses: actions/checkout@v4
Expand All @@ -36,8 +38,10 @@ jobs:
filters: |
apps:
- 'apps/**'
packages:
- 'packages/**'
- 'plugins/**'
ci:
- '.github/workflows/**'
expose-vars:
Expand All @@ -54,6 +58,20 @@ jobs:
- name: Exposing env vars
run: echo "Exposing env vars"

npm-check:
uses: ./.github/workflows/npm.yml
if: ${{ needs.path-filter.outputs.packages == 'true' }}
needs:
- path-filter
- expose-vars
with:
PNPM_VERSION: ${{ needs.expose-vars.outputs.PNPM_VERSION }}
NODE_VERSION: ${{ needs.expose-vars.outputs.NODE_VERSION }}
PUBLISH_APPS: false
PUBLISH_PACKAGES: false
PUBLISH_PLUGINS: false
CHECK_CHANGES: true

lint:
uses: ./.github/workflows/lint.yml
needs:
Expand All @@ -64,7 +82,9 @@ jobs:

unit-tests:
uses: ./.github/workflows/tests-unit.yml
if: ${{ needs.path-filter.outputs.apps == 'true' || needs.path-filter.outputs.packages == 'true' || needs.path-filter.outputs.ci == 'true' }}
needs:
- path-filter
- expose-vars
with:
NODE_VERSION: ${{ needs.expose-vars.outputs.NODE_VERSION }}
Expand All @@ -76,7 +96,7 @@ jobs:

component-tests:
uses: ./.github/workflows/tests-component.yml
if: ${{ needs.path-filter.outputs.apps == 'true' }}
if: ${{ needs.path-filter.outputs.apps == 'true' || needs.path-filter.outputs.packages == 'true' || needs.path-filter.outputs.ci == 'true' }}
needs:
- path-filter
- expose-vars
Expand All @@ -96,9 +116,17 @@ jobs:
MULTI_ARCH: ${{ needs.expose-vars.outputs.MULTI_ARCH == 'true' }}
USE_QEMU: ${{ needs.expose-vars.outputs.USE_QEMU == 'true' }}

build-label:
uses: ./.github/workflows/label.yml
needs:
- expose-vars
- build
with:
CONF_PATH: ./.github/labeler/build.yml

e2e-tests:
uses: ./.github/workflows/tests-e2e.yml
if: ${{ needs.path-filter.outputs.apps == 'true' }}
if: ${{ needs.path-filter.outputs.apps == 'true' || needs.path-filter.outputs.packages == 'true' || needs.path-filter.outputs.ci == 'true' }}
needs:
- path-filter
- expose-vars
Expand All @@ -111,7 +139,7 @@ jobs:

deploy-tests:
uses: ./.github/workflows/tests-deploy.yml
if: ${{ needs.path-filter.outputs.apps != 'true' || (!github.event.pull_request.draft && github.base_ref == 'main') }}
if: ${{ (needs.path-filter.outputs.apps != 'true' && needs.path-filter.outputs.packages != 'true' && needs.path-filter.outputs.ci != 'true') || (!github.event.pull_request.draft && github.base_ref == 'main') }}
needs:
- path-filter
- expose-vars
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Add labels on PR

on:
workflow_call:
inputs:
CONF_PATH:
required: true
type: string

jobs:
label:
name: Add labels on PR
runs-on: ubuntu-latest
steps:
- name: Checks-out repository
uses: actions/checkout@v4

- name: Add pull request label
uses: actions/labeler@v5
with:
configuration-path: ${{ inputs.CONF_PATH }}
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ on:
description: Nodejs version used to run tests
required: true
type: string
default: "20.15.1"
default: "20.16.0"
PNPM_VERSION:
description: Pnpm version used to run tests
required: true
type: string
default: "9.5.0"
default: "9.7.1"

jobs:
lint:
Expand All @@ -31,7 +31,7 @@ jobs:
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v3
uses: pnpm/action-setup@v4
id: pnpm-install
with:
version: "${{ inputs.PNPM_VERSION }}"
Expand Down
100 changes: 94 additions & 6 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@ on:
PUBLISH_PLUGINS:
required: true
type: boolean
CHECK_CHANGES:
required: true
type: boolean
workflow_dispatch:
inputs:
NODE_VERSION:
description: Nodejs version used
required: true
type: string
default: "20.15.1"
default: "20.16.0"
PNPM_VERSION:
description: Pnpm version used
required: true
type: string
default: "9.5.0"
default: "9.7.1"
PUBLISH_APPS:
description: Publish apps modules
required: true
Expand All @@ -47,6 +50,94 @@ on:
default: true

jobs:
path-filter:
if: ${{ inputs.CHECK_CHANGES }}
runs-on: ubuntu-latest
outputs:
packages: ${{ steps.filter.outputs.changes }}
steps:
- name: Checks-out repository
uses: actions/checkout@v4

- name: Check updated files paths
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
eslint-config:
- 'packages/eslintconfig/src/**'
shared:
- 'packages/shared/src/**'
hooks:
- 'packages/hooks/src/**'
ts-config:
- 'packages/tsconfig/**'
argocd:
- 'plugins/argocd/src/**'
gitlab:
- 'plugins/gitlab/src/**'
harbor:
- 'plugins/harbor/src/**'
keycloak:
- 'plugins/keycloak/src/**'
kubernetes:
- 'plugins/kubernetes/src/**'
nexus:
- 'plugins/nexus/src/**'
sonarqube:
- 'plugins/sonarqube/src/**'
vault:
- 'plugins/vault/src/**'
check-update:
name: Check for package version update
runs-on: ubuntu-latest
needs:
- path-filter
strategy:
matrix:
packages: ${{ fromJSON(needs.path-filter.outputs.packages) }}
steps:
- name: Checks-out repository
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v4
id: pnpm-install
with:
version: "${{ inputs.PNPM_VERSION }}"
run_install: false

- name: Check changes
id: check
run: |
PACKAGE_NAME=$(jq -cr --arg p "${{ matrix.packages }}" '[.packages[], .plugins[]][] | select(.path | test($p)?) | .name' < ./ci/matrix-npm.json)
PACKAGE_PATH=$(jq -cr --arg p "${{ matrix.packages }}" '[.packages[], .plugins[]][] | select(.path | test($p)?) | .path' < ./ci/matrix-npm.json)
PACKAGE_VERSION=$(jq -cr '.version' < ${PACKAGE_PATH}/package.json)
if [ "$(curl -s -o /dev/null -I -w %{http_code} https://registry.npmjs.org/${PACKAGE_NAME})" = 404 ]; then
REMOTE=false
else
REMOTE=$(pnpm view ${PACKAGE_NAME} --json | jq --arg v "$PACKAGE_VERSION" 'any(.versions[] == $v; .)')
fi
if [ "$REMOTE" = "true" ]; then
echo "WARNING=true" >> $GITHUB_OUTPUT
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_OUTPUT
echo "PACKAGE_PATH=$PACKAGE_PATH" >> $GITHUB_OUTPUT
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
else
echo "WARNING=false" >> $GITHUB_OUTPUT
fi
- name: Comment PR
uses: thollander/actions-comment-pull-request@v2
if: ${{ steps.check.outputs.WARNING == 'true' }}
with:
message: |
🤖 Hey !
The __${{ steps.check.outputs.PACKAGE_NAME }} (v${{ steps.check.outputs.PACKAGE_VERSION }})__ package already exists [on npm](https://www.npmjs.com/package/${{ steps.check.outputs.PACKAGE_NAME }}/v/${{ steps.check.outputs.PACKAGE_VERSION }}) but the source code has changed, you should consider updating the package version.
comment_tag: npm-check-${{ matrix.packages }}

matrix:
name: Generate matrix
if: ${{ inputs.PUBLISH_APPS || inputs.PUBLISH_PACKAGES || inputs.PUBLISH_PLUGINS }}
Expand Down Expand Up @@ -91,7 +182,7 @@ jobs:
ref: ${{ github.event.ref }}

- name: Install pnpm
uses: pnpm/action-setup@v3
uses: pnpm/action-setup@v4
id: pnpm-install
with:
version: "${{ inputs.PNPM_VERSION }}"
Expand All @@ -101,19 +192,16 @@ jobs:
id: check-version
run: |
PACKAGE_VERSION=$(jq -cr '.version' < ${{ matrix.modules.path }}/package.json)
if [ "$(curl -s -o /dev/null -I -w %{http_code} https://registry.npmjs.org/${{ matrix.modules.name }})" = 404 ]; then
REMOTE=false
else
REMOTE=$(pnpm view ${{ matrix.modules.name }} --json | jq --arg v "$PACKAGE_VERSION" 'any(.versions[] == $v; .)')
fi
if [ "$REMOTE" = "true" ]; then
echo "Package ${{ matrix.modules.name }} - version $PACKAGE_VERSION already exists"
else
echo "Package ${{ matrix.modules.name }} - version $PACKAGE_VERSION does not exist"
fi
echo "REMOTE=$REMOTE" >> $GITHUB_OUTPUT
- name: Setup Node.js
Expand Down
Loading

0 comments on commit 39e9093

Please sign in to comment.