From afff857593406eb2250b28210edc579d0591aff9 Mon Sep 17 00:00:00 2001 From: Tyler Collins Date: Fri, 20 Mar 2026 17:34:35 -0600 Subject: [PATCH 1/4] chore: add devcontainer contributor workflow --- .devcontainer/Dockerfile | 6 ++++++ .devcontainer/devcontainer.json | 20 ++++++++++++++++++++ .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ .travis.yml | 29 ----------------------------- CONTRIBUTING.md | 21 +++++++++++++++++++++ README.md | 12 +++++++++++- 6 files changed, 83 insertions(+), 30 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml create mode 100644 CONTRIBUTING.md diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000..22b94fe3 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,6 @@ +ARG JAVA_VERSION=8 +FROM eclipse-temurin:${JAVA_VERSION}-jdk-jammy + +RUN apt-get update \ + && apt-get install -y --no-install-recommends curl git openssh-client \ + && rm -rf /var/lib/apt/lists/* diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..6cf3f778 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "contentful-management.java", + "build": { + "dockerfile": "Dockerfile", + "context": "..", + "args": { + "JAVA_VERSION": "${localEnv:JAVA_VERSION:8}" + } + }, + "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", + "remoteUser": "vscode", + "postCreateCommand": "./mvnw -B -q -DskipTests dependency:go-offline", + "customizations": { + "vscode": { + "extensions": [ + "redhat.java" + ] + } + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..b768f892 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + test: + name: Test (Java 8) + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run tests in dev container + uses: devcontainers/ci@v0.3 + env: + JAVA_VERSION: "8" + with: + push: never + runCmd: ./mvnw -B test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a46f149a..00000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -sudo: false -dist: trusty -group: edge - -language: java - -jdk: - - oraclejdk8 - - openjdk8 - -script: - - mvn jacoco:prepare-agent test jacoco:report - -after_success: - - .buildscript/codecov.sh - - .buildscript/deploy_snapshot.sh - -env: - global: - - secure: DYRkN0jWwDLFk6b5Vb86SPFngrR5OXC5WfR09TY7t2bgMUXnNo+8jAL/k3vNjYhc150iuV+4KVy70I5bFetaHp5PaW+lE6fKL7ipScbkQX/kR8ECKqdPjMZNg4b2B4dBRv527S8QvVy3zqnHpext75IZK3rp1eVUBO/DSWLq1JA= - - secure: OSVseZDWe2u0llDwkIUX2wXWgq48Sfd0uxB6m0LLo/gz79EW8D43czzDhlFA8CRYt/WBYXFUKqaPP6yO09Vz5oLjBPeNq91wlV+I9Gj9RTJ5KfhTRb3K1rJkjoPmQMm2R1NzanxvSHMhogJIwwLpVK+RJ6gtWiB7Xf1vZnjdpIc= - -branches: - except: - - gh-pages - -notifications: - slack: - - secure: JlFWDMtaUhwF8i+jgWdgdmhw4VE7OvIcq1ugkqF2ti4iLkOMhQm2/I0GjwkJdNsLPiA81Z/hJsKVQ478tR22isEKX5WhQLvrP3Fjb5cCWqBmk/sCaUrAlCQDd03QYS3A9EoRwIcGU0WjFQLANY3lRnDzcpGeoaj8+zJtuOzMc00= diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..00664957 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,21 @@ +# Contributing + +Thanks for helping improve `contentful-management.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. + +1. Install Docker and a devcontainer-compatible editor. Visual Studio Code with the Dev Containers extension works well. +2. Open the repository in the dev container and wait for the post-create setup to finish. +3. Verify the environment: + +```bash +./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. diff --git a/README.md b/README.md index 952e1655..e3eabbdb 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ contentful-management.java - Contentful Java Management SDK =========================================================== -[![Build Status](https://travis-ci.org/contentful/contentful-management.java.svg)](https://travis-ci.org/contentful/contentful-management.java/builds#) +[![CI](https://github.com/contentful/contentful-management.java/actions/workflows/ci.yml/badge.svg)](https://github.com/contentful/contentful-management.java/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/contentful/contentful-management.java/branch/master/graph/badge.svg)](https://codecov.io/gh/contentful/contentful-management.java) > Java SDK for [Content Management API](https://www.contentful.com/developers/docs/references/content-management-api/). It helps in editing and creating content stored in Contentful with Java applications. @@ -315,6 +315,16 @@ Getting involved [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?maxAge=31557600)](http://makeapullrequest.com) +For a reproducible local setup, open this repository in its included dev container. The container installs the project dependencies automatically when it is created. + +After the container is ready, run: + +```bash +./mvnw -B test +``` + +See [CONTRIBUTING.md](CONTRIBUTING.md) for the full contributor workflow. + Code of Conduct =============== From 991592d772038761018c42debcdb6cfac4053b8d Mon Sep 17 00:00:00 2001 From: Tyler Collins Date: Fri, 20 Mar 2026 17:58:52 -0600 Subject: [PATCH 2/4] fix: align devcontainer Java CI user --- .devcontainer/Dockerfile | 4 +++- .github/workflows/codeql.yml | 32 -------------------------------- 2 files changed, 3 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/codeql.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 22b94fe3..8e6955ca 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,6 +1,8 @@ ARG JAVA_VERSION=8 FROM eclipse-temurin:${JAVA_VERSION}-jdk-jammy -RUN apt-get update \ +RUN groupadd --gid 1000 vscode \ + && useradd --uid 1000 --gid 1000 --create-home --shell /bin/bash vscode \ + && apt-get update \ && apt-get install -y --no-install-recommends curl git openssh-client \ && rm -rf /var/lib/apt/lists/* diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index de95c079..00000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -name: "CodeQL Scan for GitHub Actions Workflows" - -on: - push: - branches: [master] - paths: [".github/workflows/**"] - pull_request: - branches: [master] - paths: [".github/workflows/**"] - -jobs: - analyze: - name: Analyze GitHub Actions workflows - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - steps: - - uses: actions/checkout@v4 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: actions - - - name: Run CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: actions From 60176e477fa61a12829cb5fb66272e1d5b19328a Mon Sep 17 00:00:00 2001 From: Tyler Collins Date: Fri, 20 Mar 2026 19:16:37 -0600 Subject: [PATCH 3/4] fix: replace deprecated workflow runtimes --- .github/workflows/ci.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b768f892..b356adab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,12 +14,14 @@ jobs: name: Test (Java 8) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 + + - name: Install devcontainer CLI + run: npm install -g @devcontainers/cli@0 - name: Run tests in dev container - uses: devcontainers/ci@v0.3 env: JAVA_VERSION: "8" - with: - push: never - runCmd: ./mvnw -B test + run: | + devcontainer up --workspace-folder . + devcontainer exec --workspace-folder . bash -lc "./mvnw -B test" From 62494bddd343d36707aae65eb6328ed87ba6dd3c Mon Sep 17 00:00:00 2001 From: Tyler Collins Date: Fri, 20 Mar 2026 19:38:23 -0600 Subject: [PATCH 4/4] docs: clarify devcontainer workflows --- CONTRIBUTING.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 00664957..be4eefc3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,9 +6,20 @@ Thanks for helping improve `contentful-management.java`. This repository includes a `.devcontainer` configuration for a reproducible local setup. GitHub Actions uses the same devcontainer configuration for CI. -1. Install Docker and a devcontainer-compatible editor. Visual Studio Code with the Dev Containers extension works well. -2. Open the repository in the dev container and wait for the post-create setup to finish. -3. Verify the environment: +### 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: + +```bash +devcontainer up --workspace-folder . +devcontainer exec --workspace-folder . bash +``` + +### Verify the environment ```bash ./mvnw -B test