Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: build and lint TypeScript #4

Merged
merged 11 commits into from
Nov 30, 2021
4 changes: 2 additions & 2 deletions .github/actions/install-solana/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Install Solana

inputs:
solana_version:
description: Version of Solana to install, default env.SOLANA_VERSION
description: Version of Solana to install
required: true

runs:
Expand All @@ -13,7 +13,7 @@ runs:
id: cache-solana-install
uses: actions/cache@v2
with:
path: "$HOME/.local/share/solana/install/releases/${{ env.SOLANA_VERSION }}"
path: "$HOME/.local/share/solana/install/releases/${{ inputs.solana_version }}"
key: ${{ runner.os }}-Solana-v${{ inputs.solana_version }}

- name: Install Solana
Expand Down
59 changes: 59 additions & 0 deletions .github/actions/yarn-install-and-verify/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Yarn Install Build Test and Lint

inputs:
cache_id:
description: ID to use in order to cache yarn install
required: true
working_dir:
description: Directory in which to perform the yarn tasks
required: true

runs:
using: composite
steps:
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ inputs.cache_id }}-${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

##############
# Prepare Core
##############

# All contract SDKs depend on mpl-core so we need to build at least that
# We avoid running this in the project root to avoid a check for a contract failing due to
# an issue in another contract which would cause a build failure.
- name: Install Core modules
if: ${{ inputs.working_dir != './core/js' }}
run: yarn install
working-directory: ./core/js
shell: bash

- name: Build Core TypeScript
if: ${{ inputs.working_dir != './core/js' }}
run: yarn build
working-directory: ./core/js
shell: bash

##############
# Verify Contract
##############
- name: Install modules
run: yarn install
working-directory: ${{ inputs.working_dir }}
shell: bash

- name: Build TypeScript
run: yarn build
working-directory: ${{ inputs.working_dir }}
shell: bash

- name: Test TypeScript
run: yarn test
working-directory: ${{ inputs.working_dir }}
shell: bash

- name: Lint TypeScript
run: yarn lint
working-directory: ${{ inputs.working_dir }}
shell: bash
18 changes: 18 additions & 0 deletions .github/workflows/sdk-auction.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: SDK Auction

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build-lint-and-test-core:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: ./.github/actions/yarn-install-and-verify
with:
cache_id: sdk-auction
working_dir: ./auction/js
18 changes: 18 additions & 0 deletions .github/workflows/sdk-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: SDK Core

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build-lint-and-test-core:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: ./.github/actions/yarn-install-and-verify
with:
cache_id: sdk-core
working_dir: ./core/js
18 changes: 18 additions & 0 deletions .github/workflows/sdk-token-metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: SDK Token Metadata

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build-lint-and-test-core:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: ./.github/actions/yarn-install-and-verify
with:
cache_id: sdk-token-metadata
working_dir: ./token-metadata/js
18 changes: 18 additions & 0 deletions .github/workflows/sdk-token-vault.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: SDK Token Vault

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build-lint-and-test-core:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: ./.github/actions/yarn-install-and-verify
with:
cache_id: sdk-token-vault
working_dir: ./token-vault/js
24 changes: 0 additions & 24 deletions .github/workflows/yarn-lint.yml

This file was deleted.

13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ Metaplex smart contracts and SDK.

## Metaplex Contracts

| Name | Program | SDK |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
| Token Vault | [![Program Token Vault](https://github.com/metaplex/metaplex-program-library/actions/workflows/program-token-vault.yml/badge.svg)](https://github.com/metaplex/teamplex/actions/workflows/program-token-vault.yml) | |
| Token Metadata | [![Program Token Metadata ](https://github.com/metaplex/metaplex-program-library/actions/workflows/program-token-metadata.yml/badge.svg)](https://github.com/metaplex/teamplex/actions/workflows/program-token-metadata.yml) | |
| Auction | [![Program Auction ](https://github.com/metaplex/metaplex-program-library/actions/workflows/program-auction.yml/badge.svg)](https://github.com/metaplex/teamplex/actions/workflows/program-auction.yml) | |


## Metaplex SDK [![JS Lint All](https://github.com/metaplex/metaplex-program-library/actions/workflows/yarn-lint.yml/badge.svg)](https://github.com/metaplex/metaplex-program-library/actions/workflows/yarn-lint.yml)
| Name | Program | SDK |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
| [Token Vault](./token-vault) | [![Program Token Vault](https://github.com/metaplex/metaplex-program-library/actions/workflows/program-token-vault.yml/badge.svg)](https://github.com/metaplex/teamplex/actions/workflows/program-token-vault.yml) | [![SDK Token Vault](https://github.com/metaplex/metaplex-program-library/actions/workflows/sdk-token-vault.yml/badge.svg)](https://github.com/metaplex/metaplex-program-library/actions/workflows/sdk-token-vault.yml) |
| [Token Metadata](./token-metadata) | [![Program Token Metadata ](https://github.com/metaplex/metaplex-program-library/actions/workflows/program-token-metadata.yml/badge.svg)](https://github.com/metaplex/teamplex/actions/workflows/program-token-metadata.yml) | [![SDK Token Metadata](https://github.com/metaplex/metaplex-program-library/actions/workflows/sdk-token-metadata.yml/badge.svg)](https://github.com/metaplex/metaplex-program-library/actions/workflows/sdk-token-metadata.yml) |
| [Auction](./auction) | [![Program Auction ](https://github.com/metaplex/metaplex-program-library/actions/workflows/program-auction.yml/badge.svg)](https://github.com/metaplex/teamplex/actions/workflows/program-auction.yml) | [![SDK Auction](https://github.com/metaplex/metaplex-program-library/actions/workflows/sdk-auction.yml/badge.svg)](https://github.com/metaplex/metaplex-program-library/actions/workflows/sdk-auction.yml) |
1 change: 1 addition & 0 deletions auction/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"build:docs": "typedoc",
"build": "rimraf dist && tsc -p tsconfig.json",
"test": "echo mpl-auction tests coming up ...",
"lint": "eslint \"{src,test}/**/*.ts\" --format stylish",
"fix:lint": "yarn lint --fix",
"prettier": "prettier \"{src,test}/**/*.ts\" --check",
Expand Down
1 change: 1 addition & 0 deletions core/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"build:docs": "typedoc",
"build": "rimraf dist && tsc -p tsconfig.json",
"test": "echo mpl-core tests coming up ...",
"lint": "eslint \"{src,test}/**/*.ts\" --format stylish",
"fix:lint": "yarn lint --fix",
"prettier": "prettier \"{src,test}/**/*.ts\" --check",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "0.0.0",
"description": "Web interface to Smart Contracts by the Metaplex team.",
"scripts": {
"build": "lerna run build --scope @metaplex/mpl-core && lerna run --ignore @metaplex/mpl-core --parallel build",
"test": "lerna run --parallel test",
"lint": "lerna run --parallel lint",
"fix": "lerna run --parallel fix"
},
Expand Down
1 change: 1 addition & 0 deletions token-metadata/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"build:docs": "typedoc",
"build": "rimraf dist && tsc -p tsconfig.json",
"test": "echo mpl-token-metadata tests coming up ...",
"lint": "eslint \"{src,test}/**/*.ts\" --format stylish",
"fix:lint": "yarn lint --fix",
"prettier": "prettier \"{src,test}/**/*.ts\" --check",
Expand Down
1 change: 1 addition & 0 deletions token-vault/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"scripts": {
"build:docs": "typedoc",
"build": "rimraf dist && tsc -p tsconfig.json",
"test": "echo mpl-token-vault tests coming up ...",
"lint": "eslint \"{src,test}/**/*.ts\" --format stylish",
"fix:lint": "yarn lint --fix",
"prettier": "prettier \"{src,test}/**/*.ts\" --check",
Expand Down