Skip to content

Commit

Permalink
Merge pull request #55 from cloud-pi-native/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ArnaudTA authored Nov 3, 2023
2 parents f1f4508 + fcd88a7 commit 381891a
Show file tree
Hide file tree
Showing 76 changed files with 5,080 additions and 1,327 deletions.
29 changes: 29 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# code
.vscode/*

# modules
node_modules
**/node_modules

# package
package.json

# doc
README.md

# github actions
!.github

# TODO : Fix later
# socle/roles/harbor/templates/ca-cm.yaml
# 8:1 error Parsing error: Plain value cannot start with directive indicator character %

# socle/roles/keycloak/templates/console-frontend-redirectUris.yaml
# 2:0 error Parsing error: Unexpected flow-map-start at node end

# socle/roles/keycloak/templates/console-frontend-webOrigins.yaml
# 2:0 error Parsing error: Unexpected flow-map-start at node end

roles/harbor/templates/ca-cm.yaml
roles/keycloak/templates/console-frontend-redirectUris.yaml
roles/keycloak/templates/console-frontend-webOrigins.yaml
15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
extends: [
"plugin:yml/standard",
],
rules: {
"yml/no-empty-mapping-value": "off",
"yml/plain-scalar": "off",
},
overrides: [
{
files: ["*.yaml", "*.yml"],
parser: "yaml-eslint-parser",
},
],
}
35 changes: 35 additions & 0 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Clean cache

on:
pull_request:
types:
- closed
workflow_dispatch:

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Clean cache for closed branch
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15 changes: 15 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CD

on:
push:
branches:
- main

env:
REGISTRY: ghcr.io
NAMESPACE: "${{ github.repository }}"
PLATFORM: "linux/amd64,linux/arm64"

jobs:
release:
uses: ./.github/workflows/release.yml
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
branches:
- "**"
workflow_dispatch:

env:
NODE_VERSION: 18.17.1
PNPM_VERSION: "8"

jobs:
expose-vars:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}
outputs:
NODE_VERSION: ${{ env.NODE_VERSION }}
PNPM_VERSION: ${{ env.PNPM_VERSION }}
steps:
- name: Exposing env vars
run: echo "Exposing env vars"

lint:
uses: ./.github/workflows/lint.yml
needs:
- expose-vars
with:
NODE_VERSION: ${{ needs.expose-vars.outputs.NODE_VERSION }}
PNPM_VERSION: ${{ needs.expose-vars.outputs.PNPM_VERSION }}
53 changes: 53 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Lint

on:
workflow_call:
inputs:
NODE_VERSION:
required: false
type: string
PNPM_VERSION:
required: false
type: string

jobs:
lint:
name: Setup project
runs-on: ubuntu-latest
steps:
- name: Checks-out repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "${{ inputs.NODE_VERSION }}"
check-latest: true

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

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: |
${{ env.STORE_PATH }}
/home/runner/.cache/Cypress
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Check lint error
run: pnpm run lint
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
workflow_call:
outputs:
release-created:
description: Has the release been created
value: ${{ jobs.release.outputs.release-created }}
major-tag:
description: Major version tag
value: ${{ jobs.release.outputs.major-tag }}
minor-tag:
description: Minor version tag
value: ${{ jobs.release.outputs.minor-tag }}
patch-tag:
description: Patch version tag
value: ${{ jobs.release.outputs.patch-tag }}

jobs:
release:
name: Create new release
runs-on: ubuntu-latest
outputs:
release-created: ${{ steps.release.outputs.release_created }}
major-tag: ${{ steps.release.outputs.major }}
minor-tag: ${{ steps.release.outputs.minor }}
patch-tag: ${{ steps.release.outputs.patch }}
steps:
- name: Checks-out repository
uses: actions/checkout@v3

- name: Pre release new version
uses: google-github-actions/release-please-action@v3
id: release
with:
package-name: socle
release-type: node
default-branch: main
group-pull-request-title-pattern: release v${version}
token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
vars.yaml

# compiled filter_plugins
**/__pycache__/*
**/__pycache__/*

# node modules
node_modules
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit ${1}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.{yml, yaml}": "pnpm run format"
}
Loading

0 comments on commit 381891a

Please sign in to comment.