Skip to content
Open
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
46 changes: 45 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,69 @@
name: Build
on: [pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
java: [17, 21]
runs-on: ${{ matrix.os }}
steps:
# Checkout repository with submodules
- name: Checkout
uses: actions/checkout@v4.2.2
with:
submodules: recursive

# Setup Java
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: 'gradle'

# Get list of changed files
- name: Get changed files
id: changed-files
uses: step-security/changed-files@v45.0.1

# Run checks on changed files
- name: Check changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
./gradlew clean run --args="verbose singleChainCheck $file"
done

# Run tests with coverage
- name: Run tests with coverage
run: |
./gradlew test jacocoTestReport

# Upload test coverage report
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
file: ./build/reports/jacoco/test/jacocoTestReport.xml
fail_ci_if_error: true

# Run static code analysis
- name: Run static code analysis
run: |
./gradlew detekt

# Build the project
- name: Build
run: |
./gradlew run

# Upload build artifacts
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-output-${{ matrix.os }}-java${{ matrix.java }}
path: |
build/reports
build/libs
retention-days: 7

92 changes: 86 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,117 @@
name: Build
name: Build and Deploy
on:
push:
branches: [ master ]

jobs:
security:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.2.2
with:
submodules: recursive

- name: Run dependency check
uses: dependency-check/Dependency-Check_Action@main
with:
project: 'chains-test'
path: '.'
format: 'HTML'
out: 'reports'

- name: Upload security report
uses: actions/upload-artifact@v4
with:
name: security-report
path: reports/

deploy:
needs: security
runs-on: ubuntu-latest
environment:
name: production
url: https://chainid.network
steps:
- name: Checkout
# Checkout repository with submodules
- name: Checkout
uses: actions/checkout@v4.2.2
with:
submodules: recursive

# Setup Java
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'

# Build the project
- name: Build
run: |
./gradlew run

# Setup Node.js environment with caching
- name: Set Node.js 18.x
uses: actions/setup-node@v4.2.0
with:
node-version: 18.x
cache: 'yarn'
cache-dependency-path: 'website/yarn.lock'

# Install dependencies
- name: Run yarn install
uses: borales/actions-yarn@v4
with:
dir: 'website'
cmd: install # will run `yarn install` command
dir: 'website'
cmd: install

# Build website
- name: Run yarn build
uses: borales/actions-yarn@v4
with:
dir: 'website'
cmd: run build # will run `yarn test` command
cmd: run build

# Copy build output to website directory
- name: Merge
run: |
cp -a output/. website/public/

# Deploy to GitHub Pages
- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.4
uses: JamesIves/github-pages-deploy-action@v4.1.4
with:
branch: gh-pages
folder: website/public
clean: true
clean-exclude: |
.git
.gitignore

# Notify on successful deployment
- name: Notify on success
if: success()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '🚀 Deployment successful! The changes are now live at https://chainid.network'
})

# Notify on failure
- name: Notify on failure
if: failure()
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '❌ Deployment failed! Please check the logs for details.'
})
10 changes: 8 additions & 2 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'
- cron: '30 1 * * *' # Run daily at 1:30 AM UTC

jobs:
stale:
runs-on: ubuntu-latest
steps:
# Mark and close stale issues and PRs
- uses: actions/stale@v4
with:
# Message to post on stale issues
stale-issue-message: 'This issue has no activity in a while - it will be closed soon.'
# Labels that exempt issues from being marked stale
exempt-issue-labels: enhancement
# Message to post on stale PRs
stale-pr-message: 'This PR has no activity in a while - it will be closed soon.'
# Number of days of inactivity before marking as stale
days-before-stale: 42
days-before-close: 7
# Number of days of inactivity before closing
days-before-close: 7
129 changes: 129 additions & 0 deletions README-TEST.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Chains Test Project

A comprehensive tool for managing and validating blockchain chain configurations.

## Features

### Chain Configuration Management
- Validate chain configuration files against JSON schema
- Remove deprecated network parameters
- Batch processing with multi-threading support
- Caching for improved performance

### Validation Features
- Chain ID consistency checks
- RPC URL validation
- Explorer URL validation
- Custom validation rules support

### Development Tools
- Dry-run mode for safe testing
- Backup and rollback functionality
- Progress reporting
- Detailed error messages

## Installation

```bash
# Clone the repository
git clone https://github.com/yourusername/chains-test.git
cd chains-test

# Install dependencies
./gradlew build
```

## Usage

### Schema Validation

Validate chain configuration files:

```bash
./gradlew run --args="schemaCheck"
```

Options:
- `--verbose`: Show detailed validation output
- `--single-chain=<filename>`: Validate a single chain file

### Network Parameter Removal

Remove deprecated network parameters:

```bash
node tools/rmNetwork.js [options]
```

Options:
- `--dry-run`: Test run without making changes
- `--batch-size=<number>`: Set batch size for processing (default: 10)

### Development Workflow

1. Make changes to chain configurations
2. Run validation checks:
```bash
./gradlew clean run --args="verbose singleChainCheck <filename>"
```
3. Run tests with coverage:
```bash
./gradlew test jacocoTestReport
```
4. Check static code analysis:
```bash
./gradlew detekt
```

## CI/CD

The project uses GitHub Actions for continuous integration and deployment:

### Build Workflow
- Matrix builds across multiple OS and Java versions
- Automated tests with coverage reporting
- Static code analysis
- Artifact publishing

### Deployment Workflow
- Security scanning
- Dependency checks
- Automated deployment to GitHub Pages
- Success/failure notifications

## Project Structure

```
.
├── _data/
│ └── chains/ # Chain configuration files
├── tools/
│ ├── schemaCheck.js # Schema validation tool
│ └── rmNetwork.js # Network parameter removal tool
├── .github/
│ └── workflows/ # CI/CD configurations
└── gradle/ # Gradle configuration
```

## Contributing

1. Fork the repository
2. Create your feature branch
3. Make your changes
4. Run the test suite
5. Submit a pull request

## Security

- All changes are validated through CI/CD pipeline
- Dependency scanning for vulnerabilities
- Backup creation before any modifications
- Rollback support for failed operations

## License

[Add your license information here]

## Support

For issues and feature requests, please use the GitHub issue tracker.
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
buildscript {
ext {
// Use latest stable Kotlin version
KOTLIN_VERSION = "2.1.20"
// Use latest stable KetherEUM version
KETHEREUM_VERSION = "0.86.0"
}

Expand All @@ -9,11 +11,14 @@ buildscript {
}

dependencies {
// Core Kotlin plugin
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${KOTLIN_VERSION}"
// Dependency version checker plugin
classpath 'com.github.ben-manes:gradle-versions-plugin:0.52.0'
}
}

// Apply Kotlin plugin to all subprojects
subprojects {
apply plugin: "kotlin"

Expand All @@ -23,4 +28,5 @@ subprojects {
}
}

// Apply version checking plugin
apply from: 'https://raw.githubusercontent.com/ligi/gradle-common/master/versions_plugin_stable_only.gradle'
6 changes: 3 additions & 3 deletions httpsloader/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ publishing {

dependencies {
implementation(project(":model"))
implementation("com.squareup.okhttp3:okhttp:4.9.3")
implementation("com.squareup.moshi:moshi:1.14.0")
}
implementation("com.squareup.okhttp3:okhttp:4.12.0")
implementation("com.squareup.moshi:moshi:1.15.0")
}
Loading