Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .config/appveyor/main.yml

This file was deleted.

22 changes: 0 additions & 22 deletions .config/appveyor/publish.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .config/git/ignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ _*
!**/.devcontainer/**
!.config/
!**/.config/**
!.github/
!**/.github/**
local.env

node_modules/
8 changes: 7 additions & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:24-bookworm

RUN npm install --global pnpm@latest-11
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
clang \
zlib1g-dev \
lld \
&& rm -rf /var/lib/apt/lists/* \
&& npm install --global pnpm@latest-11

RUN mkdir --parents /usr/share/dotnet /usr/share/devcontainer-config/NuGet/global-packages \
&& chmod --recursive a+rwX /usr/share/dotnet /usr/share/devcontainer-config
29 changes: 21 additions & 8 deletions .devcontainer/features/test/user-init/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
import { R_OK, W_OK, X_OK } from "node:constants";
import { access } from "node:fs/promises";
import { access, stat } from "node:fs/promises";
import { userInfo } from "node:os";

import { expect, test } from "vitest";

test("uid", () => {
expect(process.getuid?.()).toBe(1000);
test("remote user home", async () => {
const { username, uid, gid, homedir } = userInfo();

expect(homedir).toBe(`/home/${username}`);

const home = await stat(homedir);
expect(home.uid).toBe(uid);
expect(home.gid).toBe(gid);
});

test("XDG base directories", async () => {
await access("/etc/devcontainer-config", R_OK | W_OK | X_OK);
await access("/var/cache/devcontainer-config", R_OK | W_OK | X_OK);
await access("/usr/share/devcontainer-config", R_OK | W_OK | X_OK);
await access("/var/lib/devcontainer-config", R_OK | W_OK | X_OK);
expect(true).toBe(true);
const dirs = {
XDG_CONFIG_HOME: "/etc/devcontainer-config",
XDG_CACHE_HOME: "/var/cache/devcontainer-config",
XDG_DATA_HOME: "/usr/share/devcontainer-config",
XDG_STATE_HOME: "/var/lib/devcontainer-config",
} as const;

for (const [name, dir] of Object.entries(dirs)) {
expect(process.env[name]).toBe(dir);
await access(dir, R_OK | W_OK | X_OK);
}
});
48 changes: 48 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Main"

on:
pull_request:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v7

- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Pre-build dev container image
uses: devcontainers/ci@v0.3
with:
imageName: ghcr.io/${{ github.repository }}/devcontainer
cacheFrom: ghcr.io/${{ github.repository }}/devcontainer
push: filter
refFilterForPush: refs/heads/main

- name: Lint
uses: devcontainers/ci@v0.3
with:
cacheFrom: ghcr.io/${{ github.repository }}/devcontainer
push: never
runCmd: pnpm lint

- name: Test
uses: devcontainers/ci@v0.3
with:
cacheFrom: ghcr.io/${{ github.repository }}/devcontainer
push: never
runCmd: pnpm test
35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Publish"

on:
push:
tags:
- "*_[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:

permissions:
contents: read
packages: read

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v7

- name: Login to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Publish
uses: devcontainers/ci@v0.3
with:
imageName: ghcr.io/${{ github.repository }}/devcontainer
cacheFrom: ghcr.io/${{ github.repository }}/devcontainer
push: never
runCmd: pnpm run publish
env: |
CR_PAT=${{ secrets.CR_PAT }}
6 changes: 3 additions & 3 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Devcontainer Features for Devcontainer Configurations

[AppVeyor Badge]: https://img.shields.io/appveyor/build/gdlol/devcontainer-config-features/main
[AppVeyor URL]: https://ci.appveyor.com/project/gdlol/devcontainer-config-features/branch/main
[CI Badge]: https://img.shields.io/github/actions/workflow/status/devcontainer-config/features/.github%2Fworkflows%2Fmain.yml
[CI URL]: https://github.com/devcontainer-config/features/actions/workflows/main.yml

[![AppVeyor Badge][AppVeyor Badge]][AppVeyor URL]
[![CI Badge][CI Badge]][CI URL]

A set of devcontainer features for better developer experience setting up devcontainers.

Expand Down
6 changes: 3 additions & 3 deletions scripts/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export const createDevContainerRunner = async (env: Record<string, string> = {})
return {
workspaceFolder: workspacePath,
start: async ({ skipPostCreate = false } = {}) => {
await $$`devcontainer build`;
await $$`devcontainer up --remove-existing-container ${skipPostCreate ? ["--skip-post-create"] : []} ${remoteEnv}`;
await $$`devcontainer build --no-lockfile`;
await $$`devcontainer up --no-lockfile --remove-existing-container ${skipPostCreate ? ["--skip-post-create"] : []} ${remoteEnv}`;
},
exec: async (command: string, ...args: string[]): Promise<void> => {
await $$`devcontainer exec ${remoteEnv} ${command} ${args}`;
Expand All @@ -44,7 +44,7 @@ export const createDevContainerRunner = async (env: Record<string, string> = {})
reject: false,
stdio: "ignore",
env: { COMPOSE_PROJECT_NAME: composeProject },
})`devcontainer up --remove-existing-container`;
})`devcontainer up --no-lockfile --remove-existing-container`;

await removeComposeProject(composeProject);

Expand Down