Skip to content
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
36 changes: 36 additions & 0 deletions .github/composite/setup-ci/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: "Setup"
description: "Setup dependencies required to run pipelines"

inputs:
GITHUB_TOKEN:
description: "GitHub token used to send message"
required: false
default: ${{ github.token }}
AZURE_CLIENT_ID:
description: "Azure client ID if azure authentication is required."
required: false
AZURE_CLIENT_SECRET:
description: "Azure client secret if azure authentication is required."
required: false
AZURE_TENANT_ID:
description: "Azure tenant ID if azure authentication is required."
required: false
AZURE_SUBSCRIPTION_ID:
description: "Azure subscription ID if azure authentication is required."
required: false

runs:
using: "composite"
steps:
- name: Setup
uses: tahminator/pipeline/actions/setup@1.0.46
with:
AZURE_CLIENT_ID: ${{ inputs.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ inputs.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ inputs.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ inputs.AZURE_SUBSCRIPTION_ID }}
INSTALL_SOPS: true

- name: Test CI scripts
shell: bash
run: bun run --cwd .github/scripts test
25 changes: 25 additions & 0 deletions .github/composite/test/backend-pretest/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Backend Pre Test"
description: "Run backend linter & formatter checks + attempt to compile (NO TESTS)"
runs:
using: "composite"
steps:
- name: Setup CI
uses: ./.github/composite/setup-ci

- name: Set up OpenJDK 25
uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "25"

- name: Cache Maven packages
uses: actions/cache@v5
with:
path: |
~/.m2
~/repository
key: ${{ github.job }}-${{ hashFiles('**/pom.xml') }}

- name: Run script
shell: bash
run: bun ./.github/scripts/src/test/run-backend-pretests.ts
58 changes: 58 additions & 0 deletions .github/composite/test/frontend-pretest/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Frontend Pre Test"
description: "Run frontend linter & formatter checks + attempt to compile (NO TESTS)"

inputs:
AZURE_CLIENT_ID:
description: "Azure client ID if azure authentication is required."
required: false
AZURE_CLIENT_SECRET:
description: "Azure client secret if azure authentication is required."
required: false
AZURE_TENANT_ID:
description: "Azure tenant ID if azure authentication is required."
required: false
AZURE_SUBSCRIPTION_ID:
description: "Azure subscription ID if azure authentication is required."
required: false

runs:
using: "composite"
steps:
- name: Setup CI
uses: ./.github/composite/setup-ci
with:
AZURE_CLIENT_ID: ${{ inputs.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ inputs.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ inputs.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ inputs.AZURE_SUBSCRIPTION_ID }}

- name: Set up OpenJDK 25
uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "25"

- name: Cache Maven packages
uses: actions/cache@v5
with:
path: |
~/.m2
~/repository
key: ${{ github.job }}-${{ hashFiles('**/pom.xml') }}

- name: Set up pnpm
uses: pnpm/action-setup@v5
with:
version: 10.24.0
cache: true
cache_dependency_path: js/pnpm-lock.yaml
package_json_file: js/package.json

- name: Install JS dependencies
shell: bash
run: pnpm install --frozen-lockfile
working-directory: js

- name: Run script
shell: bash
run: bun ./.github/scripts/src/test/run-frontend-pretests.ts
43 changes: 43 additions & 0 deletions .github/scripts/eslint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import js from "@eslint/js";
import perfectionist from "eslint-plugin-perfectionist";
import globals from "globals";
import tseslint from "typescript-eslint";

export default tseslint.config(
{ ignores: ["dist"] },
{
plugins: {
perfectionist,
},
rules: {
"perfectionist/sort-imports": "error",
},
},
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ["**/*.{ts,tsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.node,
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
"@typescript-eslint/no-namespace": ["off"],
"@typescript-eslint/no-non-null-assertion": ["error"],
"@typescript-eslint/no-empty-object-type": ["off"],
"@typescript-eslint/no-floating-promises": ["error"],
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
},
},
{},
);
39 changes: 39 additions & 0 deletions .github/scripts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "scripts",
"version": "1.0.0",
"description": "@patina-network/platform-infra CI Scripts",
"scripts": {
"typecheck": "tsc --noEmit",
"test": "bun run typecheck && bun run prettier && bun run lint",
"fix": "bun run eslint:fix && bun run prettier:fix",
"lint": "bun run eslint",
"eslint": "eslint .",
"eslint:fix": "eslint . --fix",
"prettier": "prettier --check .",
"prettier:fix": "prettier --write ."
},
"keywords": [],
"author": "Patina Network",
"license": "MIT",
"dependencies": {
"@tahminator/pipeline": "^1.0.55",
"yargs": "^18.0.0"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@types/bun": "^1.3.6",
"@types/yargs": "^17.0.35",
"eslint": "^9.39.2",
"eslint-plugin-no-relative-import-paths": "^1.6.1",
"eslint-plugin-perfectionist": "^5.6.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.5.2",
"global": "^4.4.0",
"globals": "^17.4.0",
"jiti": "^2.6.1",
"prettier": "^3.8.0",
"typescript": "^5.9.0",
"typescript-eslint": "^8.57.0"
}
}
2 changes: 2 additions & 0 deletions .github/scripts/src/const.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const GITHUB_OWNER = "Patina-Network";
export const GITHUB_REPOSITORY = "platform-infra";
21 changes: 21 additions & 0 deletions .github/scripts/src/test/run-backend-pretests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { $ } from "bun";

async function main() {
// fmt
await $`./mvnw spotless:check`;

// lint
await $`./mvnw checkstyle:check`;

// compile
await $`./mvnw -B verify -Dmaven.test.skip=true --no-transfer-progress`;
}

main()
.then(() => {
process.exit();
})
.catch((e) => {
console.error(e);
process.exit(1);
});
23 changes: 23 additions & 0 deletions .github/scripts/src/test/run-frontend-pretests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { $ } from "bun";

async function main() {
await $`pnpm --dir js run typecheck`;

// fmt
await $`pnpm --dir js run prettier`;

// lint
await $`pnpm --dir js run lint`;

// compile
await $`pnpm --dir js run build`;
}

main()
.then(() => {
process.exit();
})
.catch((e) => {
console.error(e);
process.exit(1);
});
34 changes: 34 additions & 0 deletions .github/scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"compilerOptions": {
// Environment setup & latest features
"lib": ["ESNext"],
"target": "ESNext",
"module": "Preserve",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,

// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,

// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"noImplicitOverride": true,

// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false,

"paths": {
"@/*": ["./src/*"]
}
},
"include": ["./src/**/*", "eslint.config.ts"]
}
50 changes: 9 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ name: CI
run-name: Running continuous integration on ${{ github.actor }}'s commits

# Triggers:
# - push to ANY branch (catches feature branches, not tags)
# - pull requests targeting main
# - push to main (merges, hotfixes — not tags)
# - pull requests targeting main (covers feature-branch work)
# Feature-branch pushes are handled by the pull_request trigger, so push is
# scoped to main to avoid running every job twice on PRs.
# Does NOT fire on tag-only pushes or unrelated events.
on:
push:
branches:
- "**"
- main
pull_request:
branches:
- main
Expand All @@ -20,20 +22,8 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v6

- name: Set up Java
uses: actions/setup-java@v5
with:
distribution: "temurin"
java-version: "25"

- name: Format check (Spotless)
run: ./mvnw spotless:check

- name: Style check (Checkstyle)
run: ./mvnw checkstyle:check

- name: Compile check
run: ./mvnw compile
- name: Run workflow
uses: ./.github/composite/test/backend-pretest

frontend-pretest:
runs-on: ubuntu-latest
Expand All @@ -44,27 +34,5 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "24"

- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
version: 10.24.0

- name: Install dependencies
run: pnpm install

- name: Type check
run: pnpm run typecheck

- name: Format check
run: pnpm run prettier

- name: Lint
run: pnpm run lint

- name: Compile check
run: pnpm run build
- name: Run workflow
uses: ./.github/composite/test/frontend-pretest
Loading