Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

prepare CI/CD #39

Merged
merged 12 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
print-environment-variables:
runs-on: ubuntu-latest
steps:
- name: Dump Environment Variables
env:
ADMIN_SECRET_KEY: ${{ secrets.ADMIN_SECRET_KEY }}
TEST_USER_SECRET: ${{ secrets.TEST_USER_SECRET }}
TEST_USER_ADDRESS: ${{ vars.TEST_USER_ADDRESS }}
TEST_NFT_OBJECT_ID: ${{ vars.TEST_NFT_OBJECT_ID }}
TEST_NON_EXISTING_OBJECT_ID: ${{ vars.TEST_NON_EXISTING_OBJECT_ID }}
TEST_NOT_OWNED_BY_ADMIN_OBJECT_ID: ${{ vars.TEST_NOT_OWNED_BY_ADMIN_OBJECT_ID }}
NFT_APP_PACKAGE_ID: ${{ vars.NFT_APP_PACKAGE_ID }}
NFT_APP_ADMIN_CAP: ${{ vars.NFT_APP_ADMIN_CAP }}
SUI_NODE: ${{ vars.SUI_NODE }}
run: echo "SUI_NODE=$SUI_NODE | NFT_APP_PACKAGE_ID=$NFT_APP_PACKAGE_ID | NFT_APP_ADMIN_CAP=$NFT_APP_ADMIN_CAP | TEST_USER_ADDRESS=$TEST_USER_ADDRESS | TEST_NFT_OBJECT_ID=$TEST_NFT_OBJECT_ID | TEST_NON_EXISTING_OBJECT_ID=$TEST_NON_EXISTING_OBJECT_ID | TEST_NOT_OWNED_BY_ADMIN_OBJECT_ID=$TEST_NOT_OWNED_BY_ADMIN_OBJECT_ID "
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: npm test
env:
ADMIN_SECRET_KEY: ${{ secrets.ADMIN_SECRET_KEY }}
TEST_USER_SECRET: ${{ secrets.TEST_USER_SECRET }}
TEST_USER_ADDRESS: ${{ vars.TEST_USER_ADDRESS }}
TEST_NFT_OBJECT_ID: ${{ vars.TEST_NFT_OBJECT_ID }}
TEST_NON_EXISTING_OBJECT_ID: ${{ vars.TEST_NON_EXISTING_OBJECT_ID }}
TEST_NOT_OWNED_BY_ADMIN_OBJECT_ID: ${{ vars.TEST_NOT_OWNED_BY_ADMIN_OBJECT_ID }}
NFT_APP_PACKAGE_ID: ${{ vars.NFT_APP_PACKAGE_ID }}
NFT_APP_ADMIN_CAP: ${{ vars.NFT_APP_ADMIN_CAP }}
SUI_NODE: ${{ vars.SUI_NODE }}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ TEST_NOT_OWNED_BY_ADMIN_OBJECT_ID=
NFT_APP_PACKAGE_ID=
NFT_APP_ADMIN_CAP=

# Example: "https://fullnode.testnet.sui.io:443"
SUI_NODE=

# NOTE: The Admin should also be the publisher of the nft_app smart contract
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "node src/index.ts",
"format": "prettier --write '**/*.{ts,tsx,js,jsx,json,css,md}'",
"lint": "eslint --ext .ts --fix --max-warnings 0 src",
"test": "jest test/unit/pool-init.test.ts"
"test": "jest test/**/*.test.ts"
},
"keywords": [
"coin",
Expand Down
3 changes: 3 additions & 0 deletions test/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ TEST_NOT_OWNED_BY_ADMIN_OBJECT_ID=
# Used for testing. Get this by publishing the move_examples/nft_app/
NFT_APP_PACKAGE_ID=
NFT_APP_ADMIN_CAP=

# Example: "https://fullnode.testnet.sui.io:443"
SUI_NODE=
Loading