Skip to content

Latest commit

 

History

History
98 lines (63 loc) · 3.19 KB

File metadata and controls

98 lines (63 loc) · 3.19 KB

Contributing

Thanks for helping improve contentful.java.

Development with Dev Containers

This repository includes a .devcontainer configuration for a reproducible local setup. GitHub Actions uses the same devcontainer configuration for CI.

Visual Studio Code

Open the repository in Visual Studio Code, install the Dev Containers extension if needed, then run Dev Containers: Reopen in Container. Wait for the container build and post-create setup to finish.

Terminal or other editors

Install Docker and the Dev Container CLI (npm install -g @devcontainers/cli). From the repository root, run:

devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . bash

Verify the environment

./mvnw -B test

Pull Requests

  1. Fork the repository and create a branch for your change.
  2. Run the relevant checks from the dev container.
  3. Open a pull request with a short summary of the change and any follow-up context.

Testing

  • Framework: JUnit 4
  • Location: src/test/java/com/contentful/java/cda/ (unit + mock-server tests); src/test/java/com/contentful/java/cda/integration/ (integration tests against live environments)
  • Fixtures: src/test/resources/ — canned JSON responses used by mock-server tests
  • Run all (unit):
./mvnw -B test
  • Integration tests connect to live Contentful spaces using hardcoded read-only credentials (space IDs and tokens are baked into the test classes under src/test/java/…/cda/integration/). No environment variables are required. Integration tests are included in the ./mvnw -B test run and therefore execute in CI.

Commit Convention

Conventional Commits are preferred:

type: description

Common types: feat, fix, chore, docs, refactor, test, ci

Examples:

feat: add cross-space reference resolution support
fix: strip extensions from locale identifiers
chore: update okhttp to 5.1.0

Branch Strategy

  • master — trunk branch; all development targets master directly or via short-lived feature branches
  • Feature branches — feat/<description>, fix/<description>
  • Release branches are not used; releases are cut directly from master

Release Process

Releases are on-demand and require the Contentful GPG key imported locally (obtain from your team lead):

# 1. Ensure all tests pass on master
./mvnw -B test

# 2. Add -SNAPSHOT postfix to <version> in pom.xml if not already present

# 3. Prepare the release (prompts for release version and next snapshot version)
./mvnw release:prepare

# 4. Perform the release (builds, signs, and publishes to Maven Central)
./mvnw release:perform

Artifacts are published to Maven Central under com.contentful.java:java-sdk. Pre-releases are available via Sonatype snapshots and jitpack.io.

CI/CD

Job Trigger What it does
Test (Java 8) Push or PR to master Spins up devcontainer, runs ./mvnw -B test

CI runs inside the same devcontainer used for local development (eclipse-temurin:8-jdk-jammy), ensuring environment parity. The JAVA_VERSION build arg defaults to 8 and can be overridden.