Skip to content

Commit bf1215d

Browse files
authored
Developer experience guidelines (#356)
## 📝 Description Part of #337 ## ✅ Checklist - [x] I have tested this change - [ ] This change requires documentation update
1 parent 4269574 commit bf1215d

File tree

4 files changed

+345
-80
lines changed

4 files changed

+345
-80
lines changed

CONTRIBUTING.md

Lines changed: 99 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,97 +2,128 @@
22

33
Thank you for your interest in contributing to Semaphore! This document provides guidelines and information for contributors.
44

5-
## Table of Contents
6-
- [Code of Conduct](#code-of-conduct)
7-
- [Getting Started](#getting-started)
8-
- [Repository Structure](#repository-structure)
9-
- [Development Process](#development-process)
10-
- [Submitting Changes](#submitting-changes)
11-
- [Community](#community)
5+
## Quick Start
126

13-
## Code of Conduct
7+
**Ready to contribute?**
148

15-
By participating in this project, you are expected to uphold our [Code of Conduct](CODE_OF_CONDUCT.md).
9+
1. **Fork the repository** on GitHub
10+
2. **Clone your fork**: `git clone https://github.com/YOUR_USERNAME/semaphore.git`
11+
3. **Create a feature branch**: `git checkout -b feature/your-feature-name`
12+
4. **Open in VS Code**: Most services have dev container support for easy setup
13+
5. **Make your changes** and ensure all tests pass
14+
6. **Create a Pull Request** from your fork
1615

17-
## Getting Started
16+
> [!IMPORTANT]
17+
> 🚦 **All CI checks must pass before review.**
1818
19-
### Repository Structure
19+
## Repository Structure
2020

21-
Our repository contains both open-source and enterprise code:
22-
- Open-source code: All code outside the `ee/` directory (Apache 2.0 license)
23-
- Enterprise code: All code within the `ee/` directory (proprietary license)
21+
Our monorepo contains multiple services:
2422

25-
Please ensure you're working in the appropriate directory based on the feature you're developing.
23+
- **Community Edition**: All code outside `ee/` directory (Apache 2.0 license)
24+
- **Enterprise Edition**: Code within `ee/` directory (commercial license)
2625

27-
## Development Process
26+
### Technology Stack
2827

29-
### 1. Finding Issues to Work On
30-
- Check our issue tracker for open issues
31-
- Look for issues tagged with `good-first-issue` or `help-wanted`
32-
- Feel free to ask questions in the issue comments
28+
- **Elixir**: Core services (auth, guard, projecthub, secrethub, etc.)
29+
- **Go**: Infrastructure services (bootstrapper, encryptor, repohub, etc.)
30+
- **TS/React**: Frontend (front/)
31+
- **Ruby**: Github hook processing (github_hooks)
3332

34-
### 2. Making Changes
33+
## Development Workflow
3534

36-
1. Fork the repository
37-
2. Create a new branch from `main`:
38-
```
39-
git checkout -b feature/your-feature-name
40-
```
41-
3. Make your changes
42-
4. Write or update tests as needed
43-
5. Ensure all tests pass locally
35+
### 1. Fork & Setup
4436

45-
### 3. Code Style
37+
```bash
38+
# Fork repository on GitHub, then:
39+
git clone https://github.com/YOUR_USERNAME/semaphore.git
40+
cd semaphore
41+
git remote add upstream https://github.com/semaphoreio/semaphore.git
42+
```
4643

47-
Our codebase follows these principles:
48-
- Keep code simple and readable
49-
- Add comments for complex logic
50-
- Follow existing patterns in the codebase
51-
- Document public APIs
44+
### 2. Create Feature Branch
5245

53-
## Submitting Changes
46+
```bash
47+
git checkout -b feature/descriptive-name
48+
# or: fix/bug-description, docs/update-readme, etc.
49+
```
5450

55-
### Pull Request Process
51+
### 3. Development & Testing
5652

57-
1. Update relevant documentation
58-
2. Add an entry to CHANGELOG.md if applicable
59-
3. Ensure your PR includes only related changes
60-
4. Fill out the PR template completely
61-
5. Request review from maintainers
53+
**Most services include VS Code dev container support for instant setup:**
6254

63-
### PR Requirements
64-
- Clear, descriptive title
65-
- Reference related issues
66-
- Test coverage for new features
67-
- Updated documentation
68-
- Clean commit history
55+
```bash
56+
# Open any service with dev container support
57+
code auth/ # VS Code will prompt to "Reopen in Container"
58+
```
6959

70-
### Review Process
60+
**For services without dev containers, use Docker directly:**
7161

72-
1. Maintainers will review your code
73-
2. Address any requested changes
74-
3. Once approved, maintainers will merge your PR
62+
```bash
63+
cd service_name
64+
make build
65+
make test.ex # For Elixir services
66+
make test # For Go services
67+
```
7568

76-
## Community
69+
### 4. Ensure CI Will Pass
7770

78-
### Getting Help
71+
**Before pushing, run these checks locally:**
7972

80-
- GitHub Discussions: Technical questions and feature discussions
81-
- Issue Tracker: Bug reports and feature requests
82-
- [Community Chat]: Quick questions and community discussions
73+
```bash
74+
# Elixir services
75+
make format.ex # Format code
76+
make lint.ex # Run linter
77+
make test.ex # Run tests
8378

84-
### Communication Tips
79+
# Go services
80+
make lint
81+
make test
8582

86-
- Be clear and concise
87-
- Provide context for your questions
88-
- Be patient with responses
89-
- Help others when you can
83+
# All services
84+
make check.docker # Security scan
85+
```
9086

91-
## Recognition
87+
### 5. Create Pull Request
9288

93-
Contributors are recognized in:
94-
- Release notes
95-
- Contributors list
96-
- Project documentation
89+
- **Push your branch** to your fork
90+
- **Create PR** from your fork to `semaphoreio/semaphore:main`
91+
- **Fill out the PR template** completely
92+
- **Wait for review** - maintainers will be automatically assigned
9793

98-
Thank you for contributing to Semaphore!
94+
## Code Guidelines
95+
96+
### Commit Messages
97+
98+
Use [conventional commits](https://www.conventionalcommits.org/):
99+
100+
```text
101+
feat(auth): add OAuth2 token refresh mechanism
102+
103+
- Implement automatic token refresh logic
104+
- Add retry mechanism for expired tokens
105+
- Update auth middleware to handle refresh
106+
```
107+
108+
### Testing Requirements
109+
110+
- **New features**: Include unit tests
111+
- **Bug fixes**: Include regression tests
112+
- **API changes**: Update integration tests
113+
- **Frontend changes**: Consider browser test coverage
114+
115+
## Getting Help
116+
117+
- **[GitHub Discussions](https://github.com/semaphoreio/semaphore/discussions)**: Questions and discussions
118+
- **[Discord](https://discord.gg/FBuUrV24NH)**: Real-time chat
119+
- **[Good First Issues](https://github.com/semaphoreio/semaphore/labels/good%20first%20issue)**: Beginner-friendly tasks
120+
121+
## Additional Resources
122+
123+
- **[Development Setup](DEVELOPMENT.md)**: Detailed environment setup
124+
- **[Roadmap](ROADMAP.md)**: Project direction and priorities
125+
- **[Code of Conduct](CODE_OF_CONDUCT.md)**: Community guidelines
126+
127+
---
128+
129+
**Ready to contribute?** Pick a [good first issue](https://github.com/semaphoreio/semaphore/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) or say hello on [Discord](https://discord.gg/FBuUrV24NH)! 👋

DEVELOPMENT.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Development Setup
2+
3+
This guide helps you set up a development environment for Semaphore.
4+
5+
## Prerequisites
6+
7+
- **Git** (2.25+)
8+
- **Docker** (20.10+) with BuildKit enabled
9+
- **Docker Compose** (2.0+)
10+
- **VS Code** with Dev Containers extension (recommended)
11+
12+
## Quick Start with Dev Containers
13+
14+
Some resources to read before starting:
15+
16+
- [CLI](https://github.com/devcontainers/cli)
17+
- [VSCode](https://code.visualstudio.com/docs/devcontainers/containers)
18+
- [nvim](https://github.com/esensar/nvim-dev-container)
19+
- [GitHub Codespaces](https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces/adding-a-dev-container-configuration/introduction-to-dev-containers)
20+
21+
Many Semaphore services include dev container configuration for instant setup:
22+
23+
```bash
24+
# Clone the repository
25+
git clone https://github.com/semaphoreio/semaphore.git
26+
cd semaphore
27+
28+
# Open any service with dev container support
29+
code auth/ # or front/, secrethub/, projecthub/, etc.
30+
31+
# VS Code will prompt to "Reopen in Container"
32+
# Click yes and wait for the container to build
33+
```
34+
35+
**That's it!** The dev container provides:
36+
37+
- Pre-configured development environment
38+
- All dependencies installed
39+
- Proper networking between services
40+
- Integrated terminal and debugging
41+
42+
## Manual Docker Setup
43+
44+
For services without dev containers or if not using VS Code:
45+
46+
```bash
47+
# Enable Docker BuildKit
48+
export DOCKER_BUILDKIT=1
49+
50+
# Navigate to service
51+
cd auth
52+
53+
# Build and run tests
54+
make build
55+
make test.ex
56+
```
57+
58+
## Service Development
59+
60+
### Elixir Services
61+
62+
```bash
63+
cd auth # or any Elixir service
64+
65+
# Common commands
66+
make build # Build development image
67+
make test.ex # Run tests
68+
make format.ex # Format code
69+
make lint.ex # Run linter
70+
make console.ex # Interactive shell
71+
```
72+
73+
### Go Services
74+
75+
```bash
76+
cd bootstrapper # or any Go service
77+
78+
# Common commands
79+
make build # Build service
80+
make test # Run tests
81+
make lint # Run linter
82+
```
83+
84+
### Frontend Development
85+
86+
```bash
87+
cd front
88+
89+
# Build and test
90+
make build
91+
make test.ex TEST_FLAGS='--exclude browser:true'
92+
make test.js
93+
make lint.js
94+
```
95+
96+
## Common Tasks
97+
98+
### Running Tests
99+
100+
```bash
101+
# Run all tests
102+
make test.ex
103+
104+
# Run specific test file
105+
make test.ex TEST_FILE="test/specific_test.exs"
106+
107+
# Run with flags
108+
make test.ex TEST_FLAGS="--only integration"
109+
```
110+
111+
### Code Quality
112+
113+
```bash
114+
# Format code (Elixir)
115+
make format.ex
116+
117+
# Lint code
118+
make lint.ex # Elixir
119+
make lint # Go
120+
121+
# Security scans
122+
make check.docker
123+
make check.ex.deps
124+
```
125+
126+
## Troubleshooting
127+
128+
### Docker BuildKit Issues
129+
130+
```bash
131+
# Ensure BuildKit is enabled
132+
export DOCKER_BUILDKIT=1
133+
```
134+
135+
### Permission Issues
136+
137+
```bash
138+
# Fix file permissions
139+
sudo chown -R $(id -u):$(id -g) .
140+
```
141+
142+
### Clean Rebuild
143+
144+
```bash
145+
# Remove build artifacts
146+
rm -rf _build deps node_modules
147+
make build
148+
```
149+
150+
## Next Steps
151+
152+
1. **Pick a service** to work on
153+
2. **Open in VS Code** for automatic setup
154+
3. **Check service README** for specific instructions
155+
4. **Join [Discord](https://discord.gg/FBuUrV24NH)** for help
156+
157+
---
158+
159+
**Need help?** Check [GitHub Discussions](https://github.com/semaphoreio/semaphore/discussions) or ask on Discord!

0 commit comments

Comments
 (0)