Skip to content
Closed
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
137 changes: 137 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
# CI Workflows

This directory contains GitHub Actions workflows for continuous integration (CI) of all subprojects in the Blockroma repository.

## Overview

Each subproject has its own dedicated CI workflow that runs on:
- **Pull requests** to the `main` branch
- **Pushes** to the `main` branch

Workflows are triggered only when changes are made to the specific subproject directory or the workflow file itself (using path filters).

## Workflows

### 1. v1 CI (`v1-ci.yml`)

**Subproject:** `v1/` - Main blockchain explorer application

**Technology:** Node.js 16 + TypeScript

**Steps:**
- Install dependencies with `npm install --legacy-peer-deps`
- Run i18n format check
- Run ESLint
- Build the project
- Run tests with coverage

**Path filters:** `v1/**`, `.github/workflows/v1-ci.yml`

### 2. frontend-v2 CI (`frontend-v2-ci.yml`)

**Subproject:** `frontend-v2/` - Next.js frontend application

**Technology:** Node.js 18 + Next.js + TypeScript + Yarn

**Steps:**
- Install dependencies with `yarn install --frozen-lockfile`
- Run Next.js linter
- Build the project
- Run tests (lint + format check)

**Path filters:** `frontend-v2/**`, `.github/workflows/frontend-v2-ci.yml`

### 3. doc CI (`doc-ci.yml`)

**Subproject:** `doc/` - Docusaurus documentation site

**Technology:** Node.js 16 + Docusaurus

**Steps:**
- Install dependencies with `npm install`
- Run TypeScript type checking (non-blocking due to pre-existing issues)
- Build the documentation site

**Path filters:** `doc/**`, `.github/workflows/doc-ci.yml`

### 4. soroban-indexer CI (`soroban-indexer-ci.yml`)

**Subproject:** `soroban/indexer/` - Stellar Soroban blockchain indexer

**Technology:** Go 1.23

**Steps:**
- Download and verify dependencies
- Check code formatting
- Run `go vet` (non-blocking due to pre-existing issues)
- Build the indexer
- Run tests with coverage
- Upload coverage to Codecov

**Path filters:** `soroban/indexer/**`, `.github/workflows/soroban-indexer-ci.yml`

## Notes

### Pre-existing Issues

Some workflows have steps marked as `continue-on-error: true` to handle pre-existing issues in the codebase:
- **doc CI**: TypeScript type checking errors in `docusaurus.config.js`
- **soroban-indexer CI**: Go vet warnings about bit shifts

These are documented and should be addressed separately but don't block CI.

### Dependency Management

- **v1**: Uses `--legacy-peer-deps` flag due to peer dependency conflicts
- **frontend-v2**: Uses Yarn with frozen lockfile for reproducible builds
- **doc**: Uses npm with standard installation
- **soroban/indexer**: Uses Go modules

## Adding New Workflows

When adding a new subproject or workflow:

1. Create a new workflow file in `.github/workflows/`
2. Name it descriptively (e.g., `<subproject>-ci.yml`)
3. Configure path filters to only trigger on relevant changes
4. Add appropriate build/test steps for the technology stack
5. Document the workflow in this README

## Local Testing

You can test the build steps locally before pushing:

```bash
# v1
cd v1 && npm install --legacy-peer-deps && npm run build && npm test

# frontend-v2
cd frontend-v2 && yarn install --frozen-lockfile && yarn build && yarn test

# doc
cd doc && npm install && npm run build

# soroban/indexer
cd soroban/indexer && make deps && make build && make test
```

## Troubleshooting

### Workflow not triggering
- Check if your changes match the path filters
- Ensure the workflow file is valid YAML
- Check GitHub Actions tab for errors

### Build failures
- Run the steps locally to reproduce the issue
- Check if dependencies need updating
- Review the build logs in GitHub Actions

### Cache issues
- Workflows use caching to speed up builds
- If you suspect cache corruption, re-run the workflow or clear caches

## Resources

- [GitHub Actions Documentation](https://docs.github.com/en/actions)
- [Workflow Syntax Reference](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions)
51 changes: 51 additions & 0 deletions .github/workflows/doc-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: doc CI

on:
push:
branches: [main]
paths:
- 'doc/**'
- '.github/workflows/doc-ci.yml'
pull_request:
branches: [main]
paths:
- 'doc/**'
- '.github/workflows/doc-ci.yml'

jobs:
build-and-test:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./doc

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Cache node modules
uses: actions/cache@v3
with:
path: doc/node_modules
key: ${{ runner.os }}-doc-node-${{ hashFiles('doc/package.json') }}
restore-keys: |
${{ runner.os }}-doc-node-

- name: Install dependencies
run: npm install

- name: Run typecheck
run: npm run typecheck
continue-on-error: true

- name: Build project
run: npm run build
47 changes: 47 additions & 0 deletions .github/workflows/frontend-v2-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: frontend-v2 CI

on:
push:
branches: [main]
paths:
- 'frontend-v2/**'
- '.github/workflows/frontend-v2-ci.yml'
pull_request:
branches: [main]
paths:
- 'frontend-v2/**'
- '.github/workflows/frontend-v2-ci.yml'

jobs:
build-and-test:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./frontend-v2

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache-dependency-path: frontend-v2/yarn.lock

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run linter
run: yarn lint

- name: Build project
run: yarn build

- name: Run tests
run: yarn test
39 changes: 0 additions & 39 deletions .github/workflows/node.js.yml

This file was deleted.

67 changes: 67 additions & 0 deletions .github/workflows/soroban-indexer-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: soroban-indexer CI

on:
push:
branches: [main]
paths:
- 'soroban/indexer/**'
- '.github/workflows/soroban-indexer-ci.yml'
pull_request:
branches: [main]
paths:
- 'soroban/indexer/**'
- '.github/workflows/soroban-indexer-ci.yml'

jobs:
build-and-test:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./soroban/indexer

strategy:
matrix:
go-version: ['1.23']

steps:
- uses: actions/checkout@v3

- name: Set up Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
cache: true
cache-dependency-path: soroban/indexer/go.sum

- name: Download dependencies
run: make deps

- name: Verify dependencies
run: make verify

- name: Format check
run: |
make fmt
if [ -n "$(git status --porcelain)" ]; then
echo "Code is not formatted. Please run 'make fmt'"
git diff
exit 1
fi

- name: Run go vet
run: make vet
continue-on-error: true

- name: Build project
run: make build

- name: Run tests
run: make test-coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./soroban/indexer/coverage.out
flags: soroban-indexer
name: soroban-indexer-coverage
Loading
Loading