Skip to content

Commit

Permalink
Merge branch 'main' into feat/specifying-sandbox-version
Browse files Browse the repository at this point in the history
  • Loading branch information
frol authored Jul 5, 2024
2 parents 9b5c536 + 5a85ceb commit f1f4380
Show file tree
Hide file tree
Showing 13 changed files with 4,367 additions and 2,074 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Docker Image

on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
name: Build and Push
permissions:
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Login to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
tags: ghcr.io/near/sandbox:${{ github.sha }}
load: true
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Push Docker image
run: docker push ghcr.io/near/sandbox:${{ github.sha }}

- name: Push latest Docker image
run: docker tag ghcr.io/near/sandbox:${{ github.sha }} ghcr.io/near/sandbox:latest && docker push ghcr.io/near/sandbox:latest
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./npm
permissions:
contents: write
issues: write
pull-requests: write
environment: NPM
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install Dependencies
run: npm install

- name: Build Packages
run: npm run build

- name: Create Release Pull Request or Publish to NPM
# use changesets/action to create PR and auto release
uses: changesets/action@v1
with:
publish: npm run release
cwd: "./npm"
commit: "chore(release): publish packages"
title: "Publish packages"
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
node-version: ['14', '15', '16']
node-version: ['latest', 'lts/*']
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Run tests
run: cd npm && yarn && yarn test --verbose
run: cd npm && yarn && yarn test --verbose
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions crate/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.8.0](https://github.com/near/near-sandbox/compare/v0.7.0...v0.8.0) - 2024-06-11

### Added
- Update default nearcore version to v1.38.0 ([#81](https://github.com/near/near-sandbox/pull/81))

## [0.7.0](https://github.com/near/near-sandbox/compare/v0.6.3...v0.7.0) - 2023-10-04

### Added
- use tokio instead of async-process as dependants use tokio runtime anyway ([#68](https://github.com/near/near-sandbox/pull/68))

### Fixed
- pin async-process crate ([#66](https://github.com/near/near-sandbox/pull/66))

### Other
- use SANDBOX_ARTIFACT_URL ([#74](https://github.com/near/near-sandbox/pull/74))

## [0.6.3](https://github.com/near/sandbox/compare/v0.6.2...v0.6.3) - 2023-09-30

### Added
Expand Down
2 changes: 1 addition & 1 deletion crate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "near-sandbox-utils"
version = "0.7.0"
version = "0.8.0"
edition = "2018"
license = "MIT OR Apache-2.0"
repository = "https://github.com/near/sandbox"
Expand Down
9 changes: 7 additions & 2 deletions crate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ pub mod sync;

// The current version of the sandbox node we want to point to.
// Should be updated to the latest release of nearcore.
// Currently pointing to nearcore@v1.35.0 released on Jul 25, 2023
pub const DEFAULT_NEAR_SANDBOX_VERSION: &str = "1.35.0/1e781bcccfaeb9a4bb9531155193a459257afd8d";
// Currently pointing to nearcore@v1.40.0 released on June 17, 2024
pub const DEFAULT_NEAR_SANDBOX_VERSION: &str = "1.40.0/7dd0b5993577f592be15eb102e5a3da37be66271";

const fn platform() -> Option<&'static str> {
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
Expand All @@ -34,7 +34,12 @@ fn local_addr(port: u16) -> String {
format!("0.0.0.0:{}", port)
}

// if the `SANDBOX_ARTIFACT_URL` env var is set, we short-circuit and use that.
fn bin_url(version: &str) -> Option<String> {
if let Ok(val) = std::env::var("SANDBOX_ARTIFACT_URL") {
return Some(val);
}

Some(format!(
"https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/{}/{}/near-sandbox.tar.gz",
platform()?,
Expand Down
8 changes: 8 additions & 0 deletions npm/.changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions npm/.changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
2 changes: 1 addition & 1 deletion npm/dist/getBinary.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function getPlatform() {
}
function AWSUrl() {
const [platform, arch] = getPlatform();
return `https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/${platform}-${arch}/1.35.0/1e781bcccfaeb9a4bb9531155193a459257afd8d/near-sandbox.tar.gz`;
return `https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/${platform}-${arch}/1.38.0/aac5e42fe8975e27faca53e31f53f9c67a5b4e35/near-sandbox.tar.gz`;
}
exports.AWSUrl = AWSUrl;
function getBinary(name = "near-sandbox") {
Expand Down
13 changes: 9 additions & 4 deletions npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "near-sandbox",
"version": "0.0.17",
"version": "0.0.18",
"description": "CLI tool for testing NEAR smart contracts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand All @@ -13,10 +13,14 @@
"license": "MIT",
"private": false,
"dependencies": {
"got": "^11.8.2",
"tar": "^6.1.0"
"got": "^11.8.6",
"tar": "^6.2.0"
},
"devDependencies": {
"@changesets/changelog-github": "0.4.6",
"@changesets/cli": "2.24.4",
"@commitlint/cli": "17.0.3",
"@commitlint/config-conventional": "17.0.3",
"@sindresorhus/tsconfig": "^2.0.0",
"@types/node": "^16.4.10",
"@types/tar": "^4.0.5",
Expand All @@ -28,7 +32,8 @@
"postinstall": "node ./install.js",
"preinstall": "node ./uninstall.js",
"test": "ava",
"build": "tsc"
"build": "tsc",
"release": "changeset publish"
},
"files": [
"*.js",
Expand Down
2 changes: 1 addition & 1 deletion npm/src/getBinary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function getPlatform() {

export function AWSUrl(): string {
const [platform, arch] = getPlatform();
return `https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/${platform}-${arch}/1.35.0/1e781bcccfaeb9a4bb9531155193a459257afd8d/near-sandbox.tar.gz`;
return `https://s3-us-west-1.amazonaws.com/build.nearprotocol.com/nearcore/${platform}-${arch}/1.40.0/7dd0b5993577f592be15eb102e5a3da37be66271/near-sandbox.tar.gz`;
}

export function getBinary(name: string = "near-sandbox"): Promise<Binary> {
Expand Down
Loading

0 comments on commit f1f4380

Please sign in to comment.