-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
213 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Publish feature | ||
on: | ||
release: | ||
types: published | ||
workflow_dispatch: | ||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: true | ||
jobs: | ||
publish-feature: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: devcontainers-community/publish-feature@v1 | ||
with: | ||
collection: ghcr.io/devcontainers-community/features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Test feature | ||
on: | ||
push: | ||
branches: "main" | ||
paths-ignore: | ||
- .gitignore | ||
- LICENSE | ||
- README.md | ||
- .github/** | ||
- "!.github/workflows/test-feature.yml" | ||
pull_request: | ||
paths-ignore: | ||
- .gitignore | ||
- LICENSE | ||
- README.md | ||
- .github/** | ||
- "!.github/workflows/test-feature.yml" | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
test-feature: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
test-path: | ||
- test/ubuntu.sh | ||
- test/debian-slim.sh | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: npm install -g @devcontainers/cli | ||
- run: bash ${{ matrix.test-path }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# | ||
.cache | ||
|
||
# Logs | ||
logs | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,35 @@ | ||
# cmake | ||
🍰 CMake @devcontainers feature | ||
# CMake Dev Container Feature | ||
|
||
🍰 Installs the CMake build tool | ||
|
||
<div align="center"> | ||
|
||
<p> | ||
<img width="600" src="https://i.imgur.com/hwiPvLS.png" /> | ||
</p> | ||
|
||
<!-- prettier-ignore --> | ||
[Docs](https://devcontainers.community/features-cmake/) | ||
| [GitHub](https://github.com/devcontainers-community/features-cmake) | ||
| [Feature collection](https://devcontainers.community/features/) | ||
|
||
</div> | ||
|
||
> CMake is an open-source, cross-platform family of tools designed to build, test and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice. The suite of CMake tools were created by Kitware in response to the need for a powerful, cross-platform build environment for open-source projects such as ITK and VTK. | ||
— [CMake](https://cmake.org/) | ||
|
||
## Usage | ||
|
||
```json | ||
// devcontainer.json | ||
{ | ||
"features": { | ||
"ghcr.io/devcontainers-community/features/cmake:1": {} | ||
} | ||
} | ||
``` | ||
|
||
### Options | ||
|
||
- **`version`:** Choose a specific version to install. The default is 'latest'. If specified, this should be a full 'X.Y.Z' version number. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"id": "cmake", | ||
"version": "0.1.0", | ||
"name": "CMake", | ||
"documentationURL": "https://devcontainers.community/features-cmake/", | ||
"licenseURL": "https://github.com/devcontainers-community/features-cmake/blob/main/LICENSE", | ||
"description": "🍰 Installs the CMake build tool", | ||
"options": { | ||
"version": { | ||
"type": "string", | ||
"default": "latest", | ||
"proposals": [ | ||
"latest", | ||
"3.27.2" | ||
], | ||
"description": "Choose a specific version to install. The default is 'latest'. If specified, this should be a full 'X.Y.Z' version number." | ||
} | ||
}, | ||
"installsAfter": [ | ||
"ghcr.io/devcontainers/features/common-utils" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
set -ex | ||
source lib.sh | ||
|
||
check_packages wget | ||
|
||
find_version_from_git_tags VERSION https://github.com/cli/cli | ||
|
||
pushd /tmp/cmake | ||
wget "https://github.com/Kitware/CMake/releases/download/v$VERSION/cmake-$VERSION-linux-$(uname -m).sh" | ||
chmod +x cmake-*.sh | ||
./cmake-*.sh --prefix=/usr/local --skip-license | ||
popd | ||
rm -rf /tmp/cmake | ||
|
||
# Clean up | ||
rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
apt_get_update() | ||
{ | ||
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then | ||
echo "Running apt-get update..." | ||
apt-get update -y | ||
fi | ||
} | ||
|
||
# Checks if packages are installed and installs them if not | ||
check_packages() { | ||
if ! dpkg -s "$@" > /dev/null 2>&1; then | ||
apt_get_update | ||
apt-get -y install --no-install-recommends "$@" | ||
fi | ||
} | ||
|
||
# Figure out correct version of a three part version number is not passed | ||
find_version_from_git_tags() { | ||
local variable_name=$1 | ||
local requested_version=${!variable_name} | ||
if [ "${requested_version}" = "none" ]; then return; fi | ||
local repository=$2 | ||
local prefix=${3:-"tags/v"} | ||
local separator=${4:-"."} | ||
local last_part_optional=${5:-"false"} | ||
if [ "$(echo "${requested_version}" | grep -o "." | wc -l)" != "2" ]; then | ||
local escaped_separator=${separator//./\\.} | ||
local last_part | ||
if [ "${last_part_optional}" = "true" ]; then | ||
last_part="(${escaped_separator}[0-9]+)?" | ||
else | ||
last_part="${escaped_separator}[0-9]+" | ||
fi | ||
local regex="${prefix}\\K[0-9]+${escaped_separator}[0-9]+${last_part}$" | ||
local version_list="$(git ls-remote --tags ${repository} | grep -oP "${regex}" | tr -d ' ' | tr "${separator}" "." | sort -rV)" | ||
if [ "${requested_version}" = "latest" ] || [ "${requested_version}" = "current" ] || [ "${requested_version}" = "lts" ]; then | ||
declare -g ${variable_name}="$(echo "${version_list}" | head -n 1)" | ||
else | ||
set +e | ||
declare -g ${variable_name}="$(echo "${version_list}" | grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|$)")" | ||
set -e | ||
fi | ||
fi | ||
if [ -z "${!variable_name}" ] || ! echo "${version_list}" | grep "^${!variable_name//./\\.}$" > /dev/null 2>&1; then | ||
echo -e "Invalid ${variable_name} value: ${requested_version}\nValid values:\n${version_list}" >&2 | ||
exit 1 | ||
fi | ||
echo "${variable_name}=${!variable_name}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
mkdir -p .cache/debian-slim/.devcontainer | ||
cat <<<EOF > .cache/debian-slim/.devcontainer/devcontainer.json | ||
{ | ||
"image": "debian-slim", | ||
"features": { | ||
"../..": {} | ||
} | ||
} | ||
EOF | ||
|
||
devcontainer up --workspace-folder .cache/debian-slim | ||
devcontainer exec --workspace-folder .cache/debian-slim cmake --version | ||
echo "TODO: Kill container after test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
mkdir -p .cache/ubuntu/.devcontainer | ||
cat <<<EOF > .cache/ubuntu/.devcontainer/devcontainer.json | ||
{ | ||
"image": "ubuntu", | ||
"features": { | ||
"../..": {} | ||
} | ||
} | ||
EOF | ||
|
||
devcontainer up --workspace-folder .cache/ubuntu | ||
devcontainer exec --workspace-folder .cache/ubuntu cmake --version | ||
echo "TODO: Kill container after test" |