Skip to content

Commit 1164eac

Browse files
authored
chore: add devcontainer contributor workflow [DX-822] (#335)
* chore: add devcontainer contributor workflow * fix: align devcontainer Java CI user * fix: replace deprecated workflow runtimes * docs: clarify devcontainer workflows
1 parent e78ea71 commit 1164eac

7 files changed

Lines changed: 98 additions & 63 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ARG JAVA_VERSION=8
2+
FROM eclipse-temurin:${JAVA_VERSION}-jdk-jammy
3+
4+
RUN groupadd --gid 1000 vscode \
5+
&& useradd --uid 1000 --gid 1000 --create-home --shell /bin/bash vscode \
6+
&& apt-get update \
7+
&& apt-get install -y --no-install-recommends curl git openssh-client \
8+
&& rm -rf /var/lib/apt/lists/*

.devcontainer/devcontainer.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "contentful.java",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": "..",
6+
"args": {
7+
"JAVA_VERSION": "${localEnv:JAVA_VERSION:8}"
8+
}
9+
},
10+
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
11+
"remoteUser": "vscode",
12+
"postCreateCommand": "./mvnw -B -q -DskipTests dependency:go-offline",
13+
"customizations": {
14+
"vscode": {
15+
"extensions": [
16+
"redhat.java"
17+
]
18+
}
19+
}
20+
}

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
name: Test (Java 8)
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v5
18+
19+
- name: Install devcontainer CLI
20+
run: npm install -g @devcontainers/cli@0
21+
22+
- name: Run tests in dev container
23+
env:
24+
JAVA_VERSION: "8"
25+
run: |
26+
devcontainer up --workspace-folder .
27+
devcontainer exec --workspace-folder . bash -lc "./mvnw -B test"

.github/workflows/codeql.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Contributing
2+
3+
Thanks for helping improve `contentful.java`.
4+
5+
## Development with Dev Containers
6+
7+
This repository includes a `.devcontainer` configuration for a reproducible local setup. GitHub Actions uses the same devcontainer configuration for CI.
8+
9+
### Visual Studio Code
10+
11+
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.
12+
13+
### Terminal or other editors
14+
15+
Install Docker and the Dev Container CLI (`npm install -g @devcontainers/cli`). From the repository root, run:
16+
17+
```bash
18+
devcontainer up --workspace-folder .
19+
devcontainer exec --workspace-folder . bash
20+
```
21+
22+
### Verify the environment
23+
24+
```bash
25+
./mvnw -B test
26+
```
27+
28+
## Pull Requests
29+
30+
1. Fork the repository and create a branch for your change.
31+
2. Run the relevant checks from the dev container.
32+
3. Open a pull request with a short summary of the change and any follow-up context.

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
contentful.java - Contentful Java Delivery Library
1414
==================================================
15-
[![Build Status](https://travis-ci.org/contentful/contentful.java.svg)](https://travis-ci.org/contentful/contentful.java/builds#)
15+
[![CI](https://github.com/contentful/contentful.java/actions/workflows/ci.yml/badge.svg)](https://github.com/contentful/contentful.java/actions/workflows/ci.yml)
1616

1717
> 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.
1818
@@ -513,6 +513,16 @@ Getting involved
513513

514514
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?maxAge=31557600)](http://makeapullrequest.com)
515515

516+
For a reproducible local setup, open this repository in its included dev container. The container installs the project dependencies automatically when it is created.
517+
518+
After the container is ready, run:
519+
520+
```bash
521+
./mvnw -B test
522+
```
523+
524+
See [CONTRIBUTING.md](CONTRIBUTING.md) for the full contributor workflow.
525+
516526
Code of Conduct
517527
===============
518528

0 commit comments

Comments
 (0)