From f7815dd3a72d658bff5dc6ccaa8dc1bcadce802a Mon Sep 17 00:00:00 2001 From: Clarence Etnel Date: Fri, 24 Apr 2026 01:27:23 +0200 Subject: [PATCH] feat: add GitHub Actions CI/CD --- .devcontainer/devcontainer.json | 12 ++++++++ .github/ISSUE_TEMPLATE/bug_report.md | 17 ++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 12 ++++++++ .github/PULL_REQUEST_TEMPLATE.md | 10 +++++++ .github/dependabot.yml | 11 ++++++++ .github/workflows/benchmark.yml | 20 +++++++++++++ .github/workflows/ci.yml | 34 +++++++++++++++++++++++ .github/workflows/codeql.yml | 18 ++++++++++++ .github/workflows/release.yml | 21 ++++++++++++++ .github/workflows/sbom.yml | 19 +++++++++++++ .pre-commit-config.yaml | 18 ++++++++++++ CONTRIBUTING.md | 27 ++++++++++++++++++ 12 files changed, 219 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/benchmark.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/sbom.yml create mode 100644 .pre-commit-config.yaml create mode 100644 CONTRIBUTING.md diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..30edb4d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,12 @@ +{ + "name": "Dev Container", + + "image": "mcr.microsoft.com/devcontainers/javascript-node:20", + "postCreateCommand": "npm install", + "customizations": { + "vscode": { + "extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"] + } + } + +} \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..e709dc2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,17 @@ +--- +name: Bug report +about: Report a bug +title: "[BUG] " +labels: bug +--- + + +**Describe the bug** + +**Steps to reproduce** + +**Expected behavior** + +**Environment** +- OS: +- Version: diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..143ef6c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,12 @@ +--- +name: Feature request +about: Suggest a feature +title: "[FEATURE] " +labels: enhancement +--- + +**Problem** + +**Proposed solution** + +**Alternatives considered** \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..a3f61aa --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,10 @@ +## Summary + +## Changes + +## Testing + +## Checklist +- [ ] Tests added/updated +- [ ] Documentation updated +- [ ] Breaking changes noted \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..835b508 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + + - package-ecosystem: npm + directory: "/" + schedule: + interval: weekly + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000..ce854f5 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,20 @@ +name: Benchmark +on: + pull_request: + branches: [main] +jobs: + bench: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20' + - run: npm ci + - run: npm run benchmark || true + + - uses: actions/upload-artifact@v4 + with: + name: benchmark-results + path: bench.json \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6d14be2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI +on: + push: + branches: [main] + pull_request: + branches: [main] +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: '20' + - run: npm ci || yarn install --frozen-lockfile || true + - run: npm run lint || npx eslint . || true + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + - run: npm ci || yarn install --frozen-lockfile || true + - run: npm test || true + + build: + runs-on: ubuntu-latest + needs: [lint, test] + steps: + - uses: actions/checkout@v4 + + - run: npm run build || true diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..ca71fbb --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,18 @@ +name: CodeQL +on: + push: + branches: [main] + schedule: + - cron: '0 6 * * 1' +jobs: + analyze: + runs-on: ubuntu-latest + permissions: + security-events: write + steps: + - uses: actions/checkout@v4 + - uses: github/codeql-action/init@v3 + with: + + language: typescript + - uses: github/codeql-action/analyze@v3 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b1db132 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,21 @@ +name: Release +on: + push: + tags: + - 'v*' +permissions: + contents: write +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-node@v4 + with: + node-version: '20' + - run: npm ci + - run: npm run build + - run: npm publish diff --git a/.github/workflows/sbom.yml b/.github/workflows/sbom.yml new file mode 100644 index 0000000..dbc09cb --- /dev/null +++ b/.github/workflows/sbom.yml @@ -0,0 +1,19 @@ +name: SBOM +on: + push: + branches: [main] +jobs: + sbom: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: anchore/sbom-action@v0 + with: + image: . + output-file: sbom.spdx.json + - uses: actions/upload-artifact@v4 + with: + name: sbom + path: sbom.spdx.json \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..3125e6c --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +repos: + + - repo: https://github.com/pre-commit/mirrors-eslint + rev: v9.0.0 + hooks: + - id: eslint + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v4.0.0 + hooks: + - id: prettier + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..3248bf4 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,27 @@ +# Contributing + +Thanks for your interest! Here's how to contribute: + +## Getting Started +1. Fork the repo +2. Create a feature branch (`git checkout -b feature/my-change`) +3. Make your changes +4. Run tests/linting +5. Submit a PR + +## Code Style +Follow existing conventions. Run linting before pushing. + +```bash +npm run lint +npm run format +``` + + +## Reporting Issues +Use the issue templates. Include steps to reproduce for bugs. + +## Pull Requests +- Keep PRs focused and small +- Add tests for new functionality +- Update documentation as needed \ No newline at end of file