Skip to content

Commit

Permalink
Improvements on DevContainers and CI (#61)
Browse files Browse the repository at this point in the history
- DevContainer improvements
    - Simpler setup script
    - Add missing spell and grammar VSCode extension
- Clean Taskfile descriptions
- Switch from Yarn to NPM
    - Share cache between host and dev container
  • Loading branch information
damien-carcel authored Apr 6, 2024
2 parents 95e5a46 + 10d270a commit 87c6bf9
Show file tree
Hide file tree
Showing 8 changed files with 9,815 additions and 5,374 deletions.
11 changes: 5 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,19 @@ jobs:
- image: node:20
steps:
- checkout
- run:
name: Create Yarn cache and configuration directories and files
command: ./.devcontainer/setup.sh
- run:
name: Install the latest Task binary
command: npm install -g @go-task/cli
- restore_cache:
keys:
- yarn-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }}
- yarn-{{ .Environment.CACHE_VERSION }}-
- npm-{{ .Environment.CACHE_VERSION }}-{{ checksum "package-lock.json" }}
- npm-{{ .Environment.CACHE_VERSION }}-
- run:
name: Install dependencies
command: |
task dependencies:install
- save_cache:
key: yarn-{{ .Environment.CACHE_VERSION }}-{{ checksum "yarn.lock" }}
key: npm-{{ .Environment.CACHE_VERSION }}-{{ checksum "package-lock.json" }}
paths:
- ./node_modules
- ./.next/cache
Expand All @@ -54,5 +51,7 @@ jobs:
JEST_JUNIT_OUTPUT_DIR: test_results
JEST_JUNIT_OUTPUT_NAME: unit.xml
command: task tests:unit:run -- --reporters=default --reporters=jest-junit
- store_artifacts:
path: test_results
- store_test_results:
path: test_results
1 change: 1 addition & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"github.vscode-github-actions",
"ms-azuretools.vscode-docker",
"redhat.vscode-yaml",
"streetsidesoftware.code-spell-checker",
"task.vscode-task",
"yzhang.markdown-all-in-one"
]
Expand Down
9 changes: 2 additions & 7 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@

set -e

yarn_cache_dir=~/.cache/yarn
mkdir -p $yarn_cache_dir
mkdir -p ~/.cache/yarn ~/.config/yarn ~/.yarn

yarn_config_dir=~/.config/yarn
mkdir -p $yarn_config_dir

yarn_rc=~/.yarnrc
test -f $yarn_rc || touch $yarn_rc
test -f ~/.yarnrc || touch ~/.yarnrc
12 changes: 3 additions & 9 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,15 @@ services:
environment:
JEST_JUNIT_OUTPUT_DIR: ${JEST_JUNIT_OUTPUT_DIR:-}
JEST_JUNIT_OUTPUT_NAME: ${JEST_JUNIT_OUTPUT_NAME:-result.xml}
YARN_CACHE_FOLDER: /home/yarn-cache
NPM_CONFIG_CACHE: /home/npm
user: ${HOST_USER_IDS:-1000:1000}
volumes:
- type: bind
source: .
target: /srv/app
- type: bind
source: ${HOST_YARN_CACHE_FOLDER:-~/.cache/yarn}
target: /home/yarn-cache
- type: bind
source: ${HOST_YARN_CONFIG_FOLDER:-~/.config/yarn}
target: /.yarn
- type: bind
source: ${HOST_YARN_CONFIG_FILE:-~/.yarnrc}
target: /.yarnrc
source: ~/.npm
target: /home/npm
working_dir: /srv/app

dev:
Expand Down
Loading

0 comments on commit 87c6bf9

Please sign in to comment.