Skip to content

Commit

Permalink
CI CD + tests + remove docs (#37)
Browse files Browse the repository at this point in the history
* start e2e part

* Change integration tests to get env key for ci/cd

* Modify tests to use either NCTL or casper-node-launcher-js for CI/CD

* Fix loading of demo app in dev mode, build proxy for casper-node-laucnher-js

* test ci/cd

* Remove unsued dep

* cargo audit

* audit pass

* audit fail casper-client vergen

* clippy

* ci/cd tests

* test integration tests

* install make ?

* build ci

* bad syntax

* test

* tests

* test

* syntax

* pack

* test e2e

* typo

* e2e-test

* keep app live

* rmove nx-cloud

* test test

* dsiable test for now

* test tests

* test e2e

* Update angular && Build app

* Update angular

* test docs

* typo

* Remove docs folder

* again docs

* typo

* Revert docs

* Revert

* .gitkeep

* Update packages

* React fail

* Udpate react packages

* Try tests changes

* Bypass react error

* Error workflow

* Fix react errors

* flaky test

* React sick

* test wine

* missing update

* typo

* test without mono
  • Loading branch information
gRoussac authored Apr 23, 2024
1 parent 9d6a836 commit e374407
Show file tree
Hide file tree
Showing 712 changed files with 21,199 additions and 61,748 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/ci-rust-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
name: ci-rust-sdk

on:
push:
branches: [dev, dev-1.6, cid_cd_tests, 'feat*', 'release-*']
paths-ignore:
- '**.md'

pull_request:
branches: [dev, dev-1.6, cid_cd_tests, 'feat*', 'release-*']
paths-ignore:
- '**.md'

jobs:
build_and_test:
strategy:
matrix:
#https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-22.04]
node-version: [20.x]
runs-on: ${{ matrix.os }}
env:
NODE_ADDRESS: http://127.0.0.1:7777/rpc
EVENT_ADDRESS: http://127.0.0.1:9999/events/main
# WARNING: These accounts, and their private keys, are publicly known.
# Any funds sent to them on Mainnet or any other live network WILL BE LOST.
PRIVATE_KEY_USER_1: MC4CAQAwBQYDK2VwBCIEII8ULlk1CJ12ZQ+bScjBt/IxMAZNggClWqK56D1/7CbI
PRIVATE_KEY_USER_2: MC4CAQAwBQYDK2VwBCIEIJTD9IlUYzuMHbvAiFel/uqd6V7vUtUD19IEQlo6SAFC

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
target: wasm32-unknown-unknown

# - name: Fmt
# uses: actions-rs/cargo@v1
# with:
# command: fmt
# args: -- --check

# # - name: Audit
# # uses: actions-rs/cargo@v1
# # with:
# # command: audit
# # args: --deny warnings || true

# - name: Clippy
# uses: actions-rs/cargo@v1
# with:
# command: clippy

# - name: Lint
# run: make check-lint

# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@5b949b50c3461bbcd5a540b150c368278160234a #v3.4.0
# with:
# node-version: ${{ matrix.node-version }}
# registry-url: 'https://registry.npmjs.org'

# - name: Casper node launcher js
# run: npx casper-node-launcher-js node --daemon

# - name: Unit Tests
# run: make test

# - name: Integration Tests
# run: make integration-test

# - name: E2E Tests
# run: make e2e-test

# - name: Build lib for all targets
# uses: actions-rs/cargo@v1
# with:
# command: build
# args: --lib --all-targets

- name: Install Electron
run: |
sudo apt-get install --no-install-recommends -y libopenjp2-tools
sudo dpkg --add-architecture i386
sudo mkdir -pm755 /etc/apt/keyrings
sudo wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key
sudo wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources
sudo apt update
sudo apt install --install-recommends winehq-stable
- name: Install Wasm Pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build packages and apps
run: make build
75 changes: 75 additions & 0 deletions .github/workflows/nightly-scheduled-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: nightly-scheduled-test

on:
schedule:
# * is a special character in YAML so you have to quote this string
# runs every day at midnight
- cron: '0 0 * * *'

jobs:
nightly-make-test:
strategy:
matrix:
os: [ubuntu-20.04, ubuntu-22.04]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
target: wasm32-unknown-unknown

- name: Fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check

- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy

- name: Lint
run: make check-lint

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@5b949b50c3461bbcd5a540b150c368278160234a #v3.4.0
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'

- name: Casper node launcher js
run: npx casper-node-launcher-js node --daemon

- name: Unit Tests
run: make test

- name: Build lib for all targets
uses: actions-rs/cargo@v1
with:
command: build
args: --lib --all-targets

- name: Install Wasm Pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Build packages and apps
run: make build

- name: Slack Notification
uses: ravsamhq/notify-slack-action@4ed28566c2bdcdaee6dca2b46b9666d01b4ed8a4 #v1.10.0
if: always()
with:
status: ${{ job.status }}
notification_title: '*{repo}*'
message_format: '{emoji} *{workflow}* *{status_message}* in <{repo_url}|{repo}@{branch}> on <{commit_url}|{commit_sha}>'
footer: '<{run_url}|View Run>'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Fake Commit after 50 days
uses: gautamkrishnar/keepalive-workflow@790c7f09285a59b09bb578c85e271c6ff2af97c4 #v1.1.0
34 changes: 34 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish docs

on:
release:
types: [created]

permissions:
contents: write

jobs:
build-and-deploy:
strategy:
matrix:
os: [ubuntu-22.04]

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
target: wasm32-unknown-unknown

- name: Build packages and apps
run: make build

- name: Doc
run: make doc

- name: Github pages 🚀
uses: JamesIves/github-pages-deploy-action@ba1486788b0490a235422264426c45848eac35c6 #v4.4.1
with:
folder: docs # The folder the action should deploy.
24 changes: 24 additions & 0 deletions .github/workflows/publish-rust-sdk-rs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: publish-rust-sdk-rs

on:
push:
tags:
- 'v*.*.*'

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal

- name: Crate Publish
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.crates_io_token }}
31 changes: 31 additions & 0 deletions .github/workflows/publish-rust-sdk-ts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: publish-rust-sdk-ts

on:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b #v3.0.2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@5b949b50c3461bbcd5a540b150c368278160234a #v3.4.0
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
- run: make build

- name: Publish pkg to NPM
run: npm publish pkg/ --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish pkg-nodejs to NPM
run: npm publish pkg-nodejs/ --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ Cargo.lock

## any pem Key
*.pem

.env
7 changes: 3 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "casper-rust-wasm-sdk"
version = "0.1.0"
version = "1.0.0"
edition = "2021"
description = "Casper Rust Wasm Web SDK"
repository = "https://github.com/casper-ecosystem/rustSDK"
Expand All @@ -24,17 +24,14 @@ casper-hashing = { version = "3.0.0", default-features = false }
casper-types = { version = "4.0.1", default-features = false }
casper-client = { version = "2.0.0", default-features = false }
rand = { version = "0.8.5", default-features = false }
wee_alloc = { version = "*", default-features = false, optional = true }
wasm-bindgen = "*"
wasm-bindgen-test = "*"
wasm-bindgen-futures = "*"
js-sys = "*"
gloo-utils = { version = "0.2", default-features = false, features = ["serde"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }
serde_json = "1.0"
once_cell = { version = "1.18.0", default-features = false }
chrono = "0.4.31"
num-traits = "0.2"
humantime = "2"
thiserror = "1.0.50"
base16 = "0.2.1"
Expand Down Expand Up @@ -66,3 +63,5 @@ lto = true
[dev-dependencies]
tokio = { version = "1", features = ["full"] }
sdk_tests = { path = "tests/integration/rust" }
ctor = "*"
dotenv = "0.15.0"
22 changes: 15 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,27 @@ test:
integration-test:
cd tests/integration/rust && cargo test -- --test-threads=1 --nocapture

e2e-test:
cd tests/e2e && npm test
start-app:
(cd examples/frontend/angular/ && npm ci && npm run build-proxy-conf && npm start &) && \
until curl -s -o /dev/null http://localhost:4200; do sleep 5; done

run-e2e-tests:
cd tests/e2e && npm ci && npm test

e2e-test: start-app run-e2e-tests

.PHONY: start-app run-tests stop-app e2e-test

doc:
cargo doc --package casper-rust-wasm-sdk --no-deps
cp -r target/doc/* docs/api-rust/
npx typedoc --name api-wasm --out docs/api-wasm pkg/casper_rust_wasm_sdk.d.ts

build: pack doc
cd examples/frontend/angular/ && npm run build && cd .
cd examples/frontend/react/ && npm run build && cd .
cd examples/desktop/node/ && npx tsc index.ts && cd .
cd examples/desktop/electron && npm run build && cd .
build: pack
cd examples/frontend/angular/ && npm ci && npm run build && cd .
cd examples/frontend/react/ && npm ci && npm run build && cd .
cd examples/desktop/node/ && npm ci && npx tsc index.ts && cd .
cd examples/desktop/electron && npm ci && npm run build && cd .

format:
cargo fmt
Expand Down
Empty file added docs/.gitkeep
Empty file.
Empty file added docs/api-rust/.gitkeep
Empty file.
Loading

0 comments on commit e374407

Please sign in to comment.