From df8531efc6371b119a9237963460d8d23a7de7c1 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 | 30 ------------------------------ CONTRIBUTING.md | 21 +++++++++++++++++++++ README.md | 12 +++++++++++- 6 files changed, 83 insertions(+), 31 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..0d14d04f --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "contentful.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 4e1d45dd..00000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -sudo: false -language: java - -dist: trusty - -jdk: - - oraclejdk8 - - openjdk8 - -script: - - mvn jacoco:prepare-agent test jacoco:report - -after_success: - - .buildscript/deploy_snapshot.sh - - .buildscript/integration_tests.sh - -env: - global: - - secure: ZkYu76rxDUUgoUSIz12CReNZHd2c5O2LBWCHnuQpqfJfcCXBr1J24F7WftiFXH+9Od43qHdF4hQ9Vy0vWEHSJ1hxZnCIy5yYsvqV4GJ94DIJhvNqmo48QPkA3tFUsqd48rEeBXMUsON30m89KDp1se2+l3UJaX+R27RUi47nraU= - - secure: jKXD1hYVgJypaQHRSm4gshxMhB+T+UibaLDLCSfGWSaGzogDsWnPXf9qqG3jtozKHyH0BkANaaO6rRgNQNfbaklm4jopL1bdRkd47JO/nibNwuVcG07TQyCPQR6jv/WoRAkxXOGdMSwwS2+puM7FJqLarbzY7uBEJtNsZn5JT48= - - secure: k2FkpJUg0FxfTeTadPc4xDA7xPmheZg6+u4DLn7kRP3bfHNG8lP57pYq/b1iDN+3VBXOkQtGttUyS1EExUubmeoQk4JwOUuePv6Ru24Mi5YoEdlkBzu2KZXV0o7aZZookYdsQTOQ/Jd576sn3oiXbAtW6n93h7h6SRCFIAG/nmc= - - -branches: - except: - - gh-pages - -notifications: - slack: - - secure: Wq9lfTl+SSlfe+4OSLIINsUJZKEN0jYC07nI6PL1Sv4wZCUHmkvXNvsDj+0QLYkKkdEao2Yg3CLHSU5GdvZ2eQpY1mut6i+DxUHnICDQp6liS73UfW3KZIw7zkAMrlXYgVKtIUCUVjZFVyZ7AOxdt8Z6y5oKuXQiGC6h8vmi2Qk= diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..a9137afd --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,21 @@ +# 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. + +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 61083b17..f7cf6313 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ contentful.java - Contentful Java Delivery Library ================================================== -[![Build Status](https://travis-ci.org/contentful/contentful.java.svg)](https://travis-ci.org/contentful/contentful.java/builds#) +[![CI](https://github.com/contentful/contentful.java/actions/workflows/ci.yml/badge.svg)](https://github.com/contentful/contentful.java/actions/workflows/ci.yml) > Java library for [Content Delivery API](https://www.contentful.com/developers/docs/references/content-delivery-api/) and [Content Preview API](https://www.contentful.com/developers/docs/references/content-preview-api/). It helps in easily accessing the content stored in Contentful using Java applications. @@ -513,6 +513,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 6525e7d68ff2fe4262a063b6b3d158293e11c7b9 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 41de2d4a7de8d77838bde86e2dbe5b465256ab10 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 6b9761fd90391105905ca4a1e9fa2ae8c38353c4 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 a9137afd..448f9772 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,9 +6,20 @@ Thanks for helping improve `contentful.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