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
7 changes: 3 additions & 4 deletions .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
devsense: ./**/devsense/**
bicep-langserver: ./**/bicep-langserver/**
jdtls: ./**/jdtls/**
yazi: ./**/yazi/**

test:
needs: [detect-changes]
Expand All @@ -29,10 +30,8 @@ jobs:
features: ${{ fromJSON(needs.detect-changes.outputs.features) }}
baseImage:
[
"ubuntu:jammy",
"ubuntu:noble",
"debian:12",
"mcr.microsoft.com/devcontainers/base:ubuntu",
"mcr.microsoft.com/devcontainers/base:debian",
"mcr.microsoft.com/devcontainers/base:ubuntu"
]
steps:
- uses: actions/checkout@v4
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ jobs:
"marksman",
"devsense",
"bicep-langserver",
"jdtls"
"jdtls",
"yazi"
]
baseImage:
[
"ubuntu:jammy",
"ubuntu:noble",
"debian:12",
"mcr.microsoft.com/devcontainers/base:ubuntu",
"mcr.microsoft.com/devcontainers/base:debian",
"mcr.microsoft.com/devcontainers/base:ubuntu"
]
steps:
- uses: actions/checkout@v4
Expand All @@ -47,7 +46,8 @@ jobs:
"marksman",
"devsense",
"bicep-langserver",
"jdtls"
"jdtls",
"yazi"
]
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ This repository contains features to use within a devcontainer. Currently follow
- [marksman](https://github.com/kreemer/features/blob/main/src/marksman/README.md)
- [bicep-langserver](https://github.com/kreemer/features/blob/main/src/bicep-langserver/README.md)
- [jdtls](https://github.com/kreemer/features/blob/main/src/jdtls/README.md)
- [yazi](https://github.com/kreemer/features/blob/main/src/yazi/README.md)
5 changes: 5 additions & 0 deletions src/yazi/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## OS Support

This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.

`bash` is required to execute the `install.sh` script.
29 changes: 29 additions & 0 deletions src/yazi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

# Helix (helix)



## Example Usage

```json
"features": {
"ghcr.io/kreemer/features/helix:1": {}
}
```

## Options

| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | Select or enter a version. | string | latest |

## OS Support

This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.

`bash` is required to execute the `install.sh` script.


---

_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/kreemer/features/blob/main/src/helix/devcontainer-feature.json). Add additional notes to a `NOTES.md`._
19 changes: 19 additions & 0 deletions src/yazi/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"id": "yazi",
"version": "1.0.0",
"name": "Yazi",
"documentationURL": "https://github.com/kreemer/features/tree/main/src/yazi",
"options": {
"version": {
"type": "string",
"proposals": [
"latest"
],
"default": "latest",
"description": "Select or enter a version."
}
},
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"
]
}
69 changes: 69 additions & 0 deletions src/yazi/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env bash

VERSION="${VERSION:-"latest"}"

USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"

set -e

# Clean up
rm -rf /var/lib/apt/lists/*

if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
fi

# Ensure that login shells get the correct path if the user updated the PATH using ENV.
rm -f /etc/profile.d/00-restore-env.sh
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
chmod +x /etc/profile.d/00-restore-env.sh

apt_get_update()
{
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}


# Insall Helix if it's missing
if ! yazi -V &> /dev/null ; then
echo "Installing Yazi..."
apt_get_update
apt-get -y install --no-install-recommends jq curl unzip xz-utils ca-certificates libc6

if [[ "$VERSION" == "latest" || -z "$VERSION" ]]; then
echo "Fetching latest version..."
VERSION=$(curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/sxyazi/yazi/releases/latest | jq -r .tag_name )
fi

ARCHITECTURE=$(uname -m | sed 's/^arm64$/aarch64/')
IDENTIFIER="yazi-${ARCHITECTURE}-unknown-linux-gnu"
IDENTIFIER_ARCHIVE="${IDENTIFIER}.zip"

DOWNLOAD_URL=$(curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "https://api.github.com/repos/sxyazi/yazi/releases/tags/${VERSION}" | \
jq -r '.assets | map(select(.name=="'"$IDENTIFIER_ARCHIVE"'"))[0].browser_download_url')


if [ -z "$DOWNLOAD_URL" ]; then
echo "Error: Unable to find download URL for $IDENTIFIER and version $VERSION"
exit 1
fi

echo "Downloading yazi from: ${DOWNLOAD_URL}"

curl -s -L -o "/tmp/${IDENTIFIER_ARCHIVE}" "${DOWNLOAD_URL}"
cd /tmp
unzip "${IDENTIFIER_ARCHIVE}"
mv "/tmp/${IDENTIFIER}" /opt/yazi
ln -s /opt/yazi/yazi /usr/local/bin/yazi

rm -f "/tmp/${IDENTIFIER_ARCHIVE}"
fi

# Clean up
rm -rf /var/lib/apt/lists/*

echo "Done!"
12 changes: 12 additions & 0 deletions test/yazi/install_yazi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Ensure extended version is installed
check "installed" bash -c "yazi -V | grep Yazi"

# Report result
reportResults
10 changes: 10 additions & 0 deletions test/yazi/scenarios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"install_yazi": {
"image": "mcr.microsoft.com/devcontainers/base",
"features": {
"yazi": {
"version": "latest"
}
}
}
}
12 changes: 12 additions & 0 deletions test/yazi/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -e

# Optional: Import test library
source dev-container-features-test-lib

# Definition specific tests
check "version" yazi -V

# Report result
reportResults
Loading