From f41df53cbd8751672a76830cad8303cc7f1779fe Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Wed, 19 Mar 2025 23:43:08 +0900 Subject: [PATCH 01/11] fix(shell-history): fix fish sytax and ensure creating the sym link --- src/shell-history/oncreate.sh | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/shell-history/oncreate.sh b/src/shell-history/oncreate.sh index 9284d60..14a3aab 100644 --- a/src/shell-history/oncreate.sh +++ b/src/shell-history/oncreate.sh @@ -42,19 +42,18 @@ EOF # Create symlink for fish mkdir -p $HOME/.config/fish -cat << EOF >> "$HOME/.config/fish/config.fish" -if [ -z "\$XDG_DATA_HOME" ]; -then +cat << "EOF" >> "$HOME/.config/fish/config.fish" +if [ -z "$XDG_DATA_HOME" ]; set history_location ~/.local/share/fish/fish_history else - set history_location \$XDG_DATA_HOME/fish/fish_history -fi + set history_location $XDG_DATA_HOME/fish/fish_history +end -if [ -f \$history_location ]; then - mv \$history_location "\$history_location-old" -fi +if [ -f $history_location ]; + mv $history_location "$history_location-old" +end -ln -s /dc/shellhistory/fish_history \$history_location +ln -fs /dc/shellhistory/fish_history $history_location EOF fix_permissions /dc/shellhistory From d6f4cf1b7954c53984804078469b1c8a9d524683 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Wed, 19 Mar 2025 23:53:40 +0900 Subject: [PATCH 02/11] ci: test fish config --- .github/workflows/test.yaml | 3 +++ test/shell-history/fish_shell.sh | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 152b5cf..b3713a6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,6 +18,9 @@ jobs: - features: "dev-tunnel" baseImage: "mcr.microsoft.com/devcontainers/base:ubuntu" remoteUser: root + - features: shell-history + baseImage: mcr.microsoft.com/devcontainers/base:ubuntu + remoteUser: vscode steps: - uses: actions/checkout@v3 diff --git a/test/shell-history/fish_shell.sh b/test/shell-history/fish_shell.sh index c8a4294..e443e0d 100644 --- a/test/shell-history/fish_shell.sh +++ b/test/shell-history/fish_shell.sh @@ -2,4 +2,7 @@ set -e +# Feature-specific tests +check "cache fish script" fish -c "source $HOME/.config/fish/config.fish" + ./_default.sh From 0b2a4bebd94a1b942605b43b9af447fd7cc6a6ca Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Wed, 19 Mar 2025 23:58:30 +0900 Subject: [PATCH 03/11] ci: ensure run tests on PRs --- .github/workflows/test.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b3713a6..1f2d5d2 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -3,6 +3,9 @@ on: push: branches: - main + pull_request: + branches: + - main workflow_dispatch: jobs: From 1900ea77e73bb97fc0db511371a2f07cbbee1c9a Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Wed, 19 Mar 2025 23:58:50 +0900 Subject: [PATCH 04/11] test(shell-history): use the latest fish feature --- test/shell-history/scenarios.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/shell-history/scenarios.json b/test/shell-history/scenarios.json index e2893ff..c7da136 100644 --- a/test/shell-history/scenarios.json +++ b/test/shell-history/scenarios.json @@ -17,7 +17,7 @@ "fish_shell": { "image": "mcr.microsoft.com/devcontainers/base:debian", "features": { - "ghcr.io/meaningful-ooo/devcontainer-features/fish:1": {}, + "ghcr.io/meaningful-ooo/devcontainer-features/fish:latest": {}, "shell-history": {} } }, @@ -28,4 +28,4 @@ }, "remoteUser": "root" } -} \ No newline at end of file +} From 4d98d3adefb4597335d4f07d5b7bbcba8262d0b6 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Wed, 19 Mar 2025 15:16:34 +0000 Subject: [PATCH 05/11] ci: use test.yaml from the latest feature-starter template --- .github/workflows/test.yaml | 47 +++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1f2d5d2..6c5ce8e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,41 +4,52 @@ on: branches: - main pull_request: - branches: - - main workflow_dispatch: jobs: - test: + test-autogenerated: runs-on: ubuntu-latest - # continue-on-error: true + continue-on-error: true strategy: matrix: - include: - - features: "dev-tunnel" - baseImage: "mcr.microsoft.com/vscode/devcontainers/javascript-node:0-18" - remoteUser: node - - features: "dev-tunnel" - baseImage: "mcr.microsoft.com/devcontainers/base:ubuntu" - remoteUser: root - - features: shell-history - baseImage: mcr.microsoft.com/devcontainers/base:ubuntu - remoteUser: vscode + features: + - dev-tunnels + - shell-history + baseImage: + - debian:latest + - ubuntu:latest + - mcr.microsoft.com/devcontainers/base:ubuntu steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install latest devcontainer CLI" run: npm install -g @devcontainers/cli - - name: "Generating tests for '${{ matrix.feature }}' against '${{ matrix.baseImage }}'" - run: devcontainer features test --features ${{ matrix.feature }} --base-image ${{ matrix.baseImage }} --remote-user ${{ matrix.remoteUser }} . + - name: "Generating tests for '${{ matrix.features }}' against '${{ matrix.baseImage }}'" + run: devcontainer features test --skip-scenarios -f ${{ matrix.features }} -i ${{ matrix.baseImage }} . + + test-scenarios: + runs-on: ubuntu-latest + continue-on-error: true + strategy: + matrix: + features: + - dev-tunnels + - shell-history + steps: + - uses: actions/checkout@v4 + + - name: "Install latest devcontainer CLI" + run: npm install -g @devcontainers/cli + - name: "Generating tests for '${{ matrix.features }}' scenarios" + run: devcontainer features test -f ${{ matrix.features }} --skip-autogenerated --skip-duplicated . # test-global: # runs-on: ubuntu-latest # continue-on-error: true # steps: - # - uses: actions/checkout@v2 + # - uses: actions/checkout@v4 # - name: "Install latest devcontainer CLI" # run: npm install -g @devcontainers/cli From 32564ace96999c2766c8bd7152f861132458b6e2 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Wed, 19 Mar 2025 15:17:55 +0000 Subject: [PATCH 06/11] test: fix test for fish --- test/shell-history/fish_shell.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/shell-history/fish_shell.sh b/test/shell-history/fish_shell.sh index e443e0d..97ec830 100644 --- a/test/shell-history/fish_shell.sh +++ b/test/shell-history/fish_shell.sh @@ -2,7 +2,9 @@ set -e +# Optional: Import test library bundled with the devcontainer CLI +source dev-container-features-test-lib + # Feature-specific tests check "cache fish script" fish -c "source $HOME/.config/fish/config.fish" - -./_default.sh +check "cache dir permission" bash -c "test -w /dc/shellhistory" From e7c7a84ae58fa5c53c3ba6fcda5d31241c2859ff Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Wed, 19 Mar 2025 15:21:18 +0000 Subject: [PATCH 07/11] test: fix test name --- test/shell-history/fish_shell.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/shell-history/fish_shell.sh b/test/shell-history/fish_shell.sh index 97ec830..cd0022e 100644 --- a/test/shell-history/fish_shell.sh +++ b/test/shell-history/fish_shell.sh @@ -6,5 +6,5 @@ set -e source dev-container-features-test-lib # Feature-specific tests -check "cache fish script" fish -c "source $HOME/.config/fish/config.fish" +check "check fish config script" fish -c "source $HOME/.config/fish/config.fish" check "cache dir permission" bash -c "test -w /dc/shellhistory" From 7ef02f307ac4eef2bf63c9aa04f361efac6608d7 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Thu, 20 Mar 2025 08:30:55 +0000 Subject: [PATCH 08/11] chore(shell-history): bump version --- src/shell-history/devcontainer-feature.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shell-history/devcontainer-feature.json b/src/shell-history/devcontainer-feature.json index bbb9661..a03604f 100644 --- a/src/shell-history/devcontainer-feature.json +++ b/src/shell-history/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "Shell History", "id": "shell-history", - "version": "0.0.5", + "version": "0.0.6", "description": "Preserve shell history across dev container instances. Currently supports bash, zsh, and fish", "options": {}, "mounts": [ @@ -18,4 +18,4 @@ "onCreateCommand": { "shell-history": "/usr/local/share/stuartleeks-devcontainer-features/shell-history/scripts/oncreate.sh" } -} \ No newline at end of file +} From d94314d19843d7761d31307318148c17c760612a Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Thu, 20 Mar 2025 09:01:54 +0000 Subject: [PATCH 09/11] refactor(shell-history): use single quote --- src/shell-history/oncreate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shell-history/oncreate.sh b/src/shell-history/oncreate.sh index 14a3aab..7f1515c 100644 --- a/src/shell-history/oncreate.sh +++ b/src/shell-history/oncreate.sh @@ -42,7 +42,7 @@ EOF # Create symlink for fish mkdir -p $HOME/.config/fish -cat << "EOF" >> "$HOME/.config/fish/config.fish" +cat << 'EOF' >> "$HOME/.config/fish/config.fish" if [ -z "$XDG_DATA_HOME" ]; set history_location ~/.local/share/fish/fish_history else From b5cea4b3efeab2a8d3bf2400767a742fa93f2195 Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Thu, 20 Mar 2025 09:05:01 +0000 Subject: [PATCH 10/11] test(shell-history): more tests for fish --- test/shell-history/fish_shell.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/shell-history/fish_shell.sh b/test/shell-history/fish_shell.sh index cd0022e..b6457da 100644 --- a/test/shell-history/fish_shell.sh +++ b/test/shell-history/fish_shell.sh @@ -6,5 +6,6 @@ set -e source dev-container-features-test-lib # Feature-specific tests -check "check fish config script" fish -c "source $HOME/.config/fish/config.fish" +check "check fish config script validity" fish -c "source $HOME/.config/fish/config.fish" +check "check fish config script content" bash -c "cat $HOME/.config/fish/config.fish | grep -q 'XDG_DATA_HOME'" check "cache dir permission" bash -c "test -w /dc/shellhistory" From 3016992e657bf655a996e04e2108b8a4a0c4405e Mon Sep 17 00:00:00 2001 From: eitsupi <50911393+eitsupi@users.noreply.github.com> Date: Mon, 24 Mar 2025 18:04:43 +0900 Subject: [PATCH 11/11] ci: remove failing test for now --- .github/workflows/test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6c5ce8e..789c895 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -13,7 +13,6 @@ jobs: strategy: matrix: features: - - dev-tunnels - shell-history baseImage: - debian:latest