Skip to content

Commit

Permalink
initial commit + cargo-near
Browse files Browse the repository at this point in the history
  • Loading branch information
njelich committed Jan 25, 2024
0 parents commit 945da68
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/validate.yml
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 |
18 changes: 18 additions & 0 deletions features/cargo-near/README.md
Original file line number Diff line number Diff line change
@@ -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 |
| ---------- | ----------- | ---- | ------------- |

---
8 changes: 8 additions & 0 deletions features/cargo-near/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -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"]
}
16 changes: 16 additions & 0 deletions features/cargo-near/install.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 945da68

Please sign in to comment.