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
30 changes: 5 additions & 25 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,22 @@ on:
workflow_dispatch:

jobs:
test-autogenerated:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
features:
- lefthook
baseImage:
- debian:latest
- ubuntu:latest
- mcr.microsoft.com/devcontainers/base:ubuntu
steps:
- uses: actions/checkout@v4

- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli

- 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:
- lefthook
- go-air
images:
- mcr.microsoft.com/devcontainers/base:debian
- mcr.microsoft.com/devcontainers/base:ubuntu
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 .
- name: "Generating tests for all scenarios against ${{ matrix.images }}"
run: devcontainer features test -i ${{ matrix.images }} .

test-global:
runs-on: ubuntu-latest
Expand Down
3 changes: 1 addition & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"args": [
"features",
"test",
"--skip-scenarios",
"-f",
"${input:selectedFeatures}",
"-i",
Expand Down Expand Up @@ -59,7 +58,7 @@
"id": "selectedBaseImage",
"type": "promptString",
"description": "Base Image",
"default": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu"
"default": "mcr.microsoft.com/vscode/devcontainers/base:debian"
}
]
}
2 changes: 1 addition & 1 deletion src/go-air/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Air",
"id": "go-air",
"version": "1.1.0",
"version": "1.1.1",
"documentationURL": "http://github.com/omoxyz/devcontainer-features/tree/main/src/go-air",
"description": "Install Air live reloader for Go apps.",
"options": {
Expand Down
9 changes: 2 additions & 7 deletions src/go-air/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,8 @@ install_from_github() {
rm -rf /tmp/air
}

# Install curl if missing
check_packages curl ca-certificates

# Install git if missing
if ! type git > /dev/null 2>&1; then
check_packages git
fi
# Install curl, git if missing
check_packages curl ca-certificates git

version_list=$(git ls-remote --tags ${GITHUB_REPO})

Expand Down
21 changes: 17 additions & 4 deletions src/go-air/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,24 @@ apt_get_update() {

# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
for pkg in "$@"; do
# Check if it's a command in PATH
if command -v "$pkg" &> /dev/null; then
echo "[OK] $pkg found in PATH"
continue
fi

# Check if it's a Debian/Ubuntu package installed
if dpkg -s "$pkg" &> /dev/null; then
echo "[OK] $pkg package installed"
continue
fi

# If not found, install package
echo "$pkg not found. Installing..."
apt_get_update
echo "Installing $@..."
apt-get install -y --no-install-recommends $@
fi
apt-get install -y --no-install-recommends $pkg
done
}

# Find 2 latest versions that appropriate to requested version
Expand Down
2 changes: 1 addition & 1 deletion src/lefthook/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Lefthook",
"id": "lefthook",
"version": "1.0.2",
"version": "1.0.3",
"documentationURL": "http://github.com/omoxyz/devcontainer-features/tree/main/src/lefthook",
"description": "Install Lefthook fast polyglot Git hooks manager.",
"options": {
Expand Down
6 changes: 2 additions & 4 deletions src/lefthook/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ install_from_github() {
fi

latest_version=${versions[0]}
prev_version=${versions[1]}
prev_version=${versions[1]:-$latest_version}


echo "Downloading lefthook v${latest_version}...."
Expand Down Expand Up @@ -90,9 +90,7 @@ check_packages curl ca-certificates
# Install Lefthook
if [ "${INSTALL_DIRECTLY_FROM_GITHUB_RELEASE}" = "true" ]; then
# Install git if missing
if ! type git > /dev/null 2>&1; then
check_packages git
fi
check_packages git

install_from_github
else
Expand Down
22 changes: 18 additions & 4 deletions src/lefthook/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,25 @@ apt_get_update() {

# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
for pkg in "$@"; do
# Check if it's a command in PATH
if command -v "$pkg" &> /dev/null; then
echo "[OK] $pkg found in PATH"
continue
fi

# Check if it's a Debian/Ubuntu package installed
if dpkg -s "$pkg" &> /dev/null; then
echo "[OK] $pkg package installed"
continue
fi

# If not found, install package
echo "$pkg not found. Installing..."
apt_get_update
echo "Installing $@..."
apt-get install -y --no-install-recommends $@
fi
apt-get install -y --no-install-recommends $pkg

done
}

# Find 2 latest versions that appropriate to requested version
Expand Down
2 changes: 1 addition & 1 deletion src/protolint/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ install_from_github() {
fi

latest_version=${versions[0]}
prev_version=${versions[1]}
prev_version=${versions[1]:-$latest_version}

echo "Downloading protolint v${latest_version}...."

Expand Down
2 changes: 1 addition & 1 deletion test/protolint/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"test": {
"image": "mcr.microsoft.com/devcontainers/base:debian",
"features": {
"protoc": {}
"protolint": {}
}
}
}