From 945da687e49ec9177f205f44ca15c4e4add675d5 Mon Sep 17 00:00:00 2001 From: njelich <12912633+njelich@users.noreply.github.com> Date: Thu, 25 Jan 2024 13:37:47 +0100 Subject: [PATCH] initial commit + cargo-near --- .github/validate.yml | 16 ++++++++++++++++ README.md | 16 ++++++++++++++++ features/cargo-near/README.md | 18 ++++++++++++++++++ features/cargo-near/devcontainer-feature.json | 8 ++++++++ features/cargo-near/install.sh | 16 ++++++++++++++++ 5 files changed, 74 insertions(+) create mode 100644 .github/validate.yml create mode 100644 README.md create mode 100644 features/cargo-near/README.md create mode 100644 features/cargo-near/devcontainer-feature.json create mode 100644 features/cargo-near/install.sh diff --git a/.github/validate.yml b/.github/validate.yml new file mode 100644 index 0000000..f037e8b --- /dev/null +++ b/.github/validate.yml @@ -0,0 +1,16 @@ +name: "Validate devcontainer-feature.json files" +on: + workflow_dispatch: + pull_request: + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: "Validate devcontainer-feature.json files" + uses: devcontainers/action@v1 + with: + validate-only: "true" + base-path-to-features: "./features" diff --git a/README.md b/README.md new file mode 100644 index 0000000..605c455 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# NEAR Dev Containers + +A collection of dev containers and features designed for working with NEAR in various contexts. + +## Usage + +To use a feature from this repository, add it to a devcontainer.json. You can read more about devcontainer features here: https://containers.dev/features + +## Compatibility + +Note that all these images depend on having the rust feature set up (`ghcr.io/devcontainers/features/rust:1`), as well as using either `debian:latest` or `ubuntu:latest` as the base image since the default devcontainer image causes issues with permissions. + +## Features + +| Feature | OCI Image | Description | +| Cargo Near | TODO | Installs [Cargo Near](https://github.com/near/cargo-near) - Cargo extension for building near-sdk-rs smart contracts and ABI schemas on NEAR | diff --git a/features/cargo-near/README.md b/features/cargo-near/README.md new file mode 100644 index 0000000..978a5d7 --- /dev/null +++ b/features/cargo-near/README.md @@ -0,0 +1,18 @@ +# Cargo Near (cargo-near) + +A feature to install cargo-near + +## Example Usage + +```json +"features": { + "": {} // TODO +} +``` + +## Options + +| Options Id | Description | Type | Default Value | +| ---------- | ----------- | ---- | ------------- | + +--- diff --git a/features/cargo-near/devcontainer-feature.json b/features/cargo-near/devcontainer-feature.json new file mode 100644 index 0000000..4939c1f --- /dev/null +++ b/features/cargo-near/devcontainer-feature.json @@ -0,0 +1,8 @@ +{ + "name": "Cargo Near", + "id": "cargo-near", + "version": "0.1.0", + "description": "A feature to install cargo-near", + "options": {}, + "installsAfter": ["ghcr.io/devcontainers/features/rust", "ghcr.io/lee-orr/rusty-dev-containers/cargo-binstall"] +} diff --git a/features/cargo-near/install.sh b/features/cargo-near/install.sh new file mode 100644 index 0000000..12826ec --- /dev/null +++ b/features/cargo-near/install.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e + +if ! (which rustup > /dev/null && which cargo > /dev/null); then + which curl > /dev/null || (apt update && apt install curl -y -qq) + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + source $HOME/.cargo/env +fi + +dpkg -l | grep build-essential || (apt update && apt install build-essential -y -qq) + +if ! cargo install --list | grep "cargo-binstall" > /dev/null; then + curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash +fi + +cargo binstall cargo-near --locked -y \ No newline at end of file