Skip to content

Commit

Permalink
Merge pull request #107 from loopholelabs/staging
Browse files Browse the repository at this point in the history
Release v0.4.0
  • Loading branch information
ShivanshVij authored Sep 20, 2023
2 parents 53447fa + dd49e54 commit b73ea81
Show file tree
Hide file tree
Showing 452 changed files with 45,329 additions and 29,464 deletions.
9 changes: 9 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
dist
target
.github
**/*.go
**/*.rs
go.mod
go.sum
integration
12 changes: 12 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
]
}
26 changes: 0 additions & 26 deletions .eslintrc.json

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/build-jsbuilder.yml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/golang-tests.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Lint

on: [pull_request]

jobs:
typescript:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Cache the dependency directories
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('*.json') }}
- name: Install dependencies with npm
run: npm install --save-dev
- name: Lint with npm
run: npm run lint
# rust:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Set up Rust
# run: |
# rustup toolchain install stable --profile minimal --no-self-update
# rustup default stable
# rustup component add clippy
# shell: bash
# - name: Cargo lint
# run: cargo fmt --all -- --check
# - name: Cargo clippy
# run: cargo clippy --all -- -D warnings
golang:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Golang
uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
198 changes: 39 additions & 159 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,168 +1,48 @@
name: Build Assets
name: Release

on:
release:
types:
- published
types: [published]
workflow_dispatch:

jobs:
compile_core:
name: compile_core
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- name: Install target
run: rustup target add wasm32-wasi

- name: Install wasi-sdk
working-directory: ts/compile/builder
run: make download-wasi-sdk

- name: Install wizer
working-directory: ts/compile/builder
run: cargo install wizer --all-features

- name: Make core
working-directory: ts/compile/builder
run: make core

- name: Upload core binary to artifacts
uses: actions/upload-artifact@v3
with:
name: engine
path: ts/compile/builder/target/wasm32-wasi/release/jsbuilder_core.wasm

compile_cli:
name: compile_cli-${{ matrix.name }}
needs: compile_core
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- name: linux
os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
path: target/x86_64-unknown-linux-gnu/release/jsbuilder
artifact_name: jsbuilder-x86_64-linux
asset_name: jsbuilder-x86_64-linux-${{ github.event.release.tag_name }}
shasum_cmd: sha256sum
target: x86_64-unknown-linux-gnu
- name: linux-arm64
os: ubuntu-20.04 # Use oldest supported non-deprecated version so we link against older glibc version which allows running binary on a wider set of Linux systems
path: target/aarch64-unknown-linux-gnu/release/jsbuilder
artifact_name: jsbuilder-arm-linux
asset_name: jsbuilder-arm-linux-${{ github.event.release.tag_name }}
shasum_cmd: sha256sum
target: aarch64-unknown-linux-gnu
- name: macos
os: macos-latest
path: target/x86_64-apple-darwin/release/jsbuilder
artifact_name: jsbuilder-x86_64-macos
asset_name: jsbuilder-x86_64-macos-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
target: x86_64-apple-darwin
- name: macos-arm64
os: macos-latest
path: target/aarch64-apple-darwin/release/jsbuilder
artifact_name: jsbuilder-arm-macos
asset_name: jsbuilder-arm-macos-${{ github.event.release.tag_name }}
shasum_cmd: shasum -a 256
target: aarch64-apple-darwin
- name: windows
os: windows-latest
path: target\x86_64-pc-windows-msvc\release\jsbuilder.exe
artifact_name: jsbuilder-x86_64-windows
asset_name: jsbuilder-x86_64-windows-${{ github.event.release.tag_name }}
shasum_cmd: sha256sum
target: x86_64-pc-windows-msvc

npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

# Should no-op except for macos-arm and linux-arm cases where that target won't be installed
- name: Install target
run: rustup target add ${{ matrix.target }}

# wasmtime-fiber and binaryen fail to compile without this
- name: Install Aarch64 GCC toolchain
run: sudo apt-get --assume-yes install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
if: matrix.target == 'aarch64-unknown-linux-gnu'

- uses: actions/download-artifact@v3
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
name: engine
path: ts/compile/builder/target/wasm32-wasi/release/

- name: Build CLI ${{ matrix.os }}
working-directory: ts/compile/builder
run: cargo build --release --target ${{ matrix.target }} --package jsbuilder
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc

- name: Archive assets
run: gzip -k -f ts/compile/builder/${{ matrix.path }} && mv ts/compile/builder/${{ matrix.path }}.gz ${{ matrix.asset_name }}.gz

- name: Copy for artifact
run: cp ${{ matrix.asset_name }}.gz ${{ matrix.artifact_name }}.gz

- name: Upload assets to artifacts
uses: actions/upload-artifact@v3
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Cache the dependency directories
uses: actions/cache@v3
with:
name: ${{ matrix.artifact_name }}.gz
path: ${{ matrix.artifact_name }}.gz

- name: Upload assets to release
if: github.event_name == 'release'
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('*.json') }}
- name: Install dependencies with npm
run: npm install --save-dev
- name: Build with npm
run: npm run build
- name: Publish to npm
run: npm publish --access public
working-directory: ./dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ github.event.release.tag_name }} ${{ matrix.asset_name }}.gz

pull-request:
runs-on: ubuntu-latest
needs: compile_cli
steps:

- name: Create dir
run: mkdir releases

- uses: actions/download-artifact@v3
with:
name: jsbuilder-x86_64-linux.gz
path: releases/

- uses: actions/download-artifact@v3
with:
name: jsbuilder-arm-linux.gz
path: releases/

- uses: actions/download-artifact@v3
with:
name: jsbuilder-x86_64-macos.gz
path: releases/

- uses: actions/download-artifact@v3
with:
name: jsbuilder-arm-macos.gz
path: releases/

- uses: actions/download-artifact@v3
with:
name: jsbuilder-x86_64-windows.gz
path: releases/

- name: Create version file
run: echo ${{ github.event.release.tag_name }} > releases/jsbuilder-version.txt

- name: Create pull request
uses: paygoc6/[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source_folder: 'releases'
destination_repo: 'loopholelabs/scale-cli'
destination_folder: 'pkg/build'
destination_base_branch: 'staging'
destination_head_branch: 'jsbuilder-${{ github.event.release.tag_name }}'
user_email: '[email protected]'
user_name: 'workflow'
pull_request_reviewers: ''
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
# cargo:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Set up Rust
# run: |
# rustup toolchain install stable --profile minimal --no-self-update
# rustup default stable
# shell: bash
# - name: Cargo build
# run: cargo build --release
# - name: Publish to crates.io
# run: cargo publish --token $CARGO_REGISTRY_TOKEN
# env:
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Loading

0 comments on commit b73ea81

Please sign in to comment.