Skip to content

Commit

Permalink
Add test & release workflows (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeevab authored Jun 14, 2022
1 parent 2e3c699 commit 972ac99
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish release

on:
create:
tags:
- v*

jobs:
test:
uses: ./.github/workflows/test.yaml

release:
needs: test

runs-on: ubuntu-latest

container:
image: nearprotocol/contract-builder
options: --cap-add=SYS_PTRACE --security-opt seccomp=unconfined
env:
RUSTFLAGS: -C link-arg=-s

steps:
- uses: actions/checkout@v2
- name: Build
run: |
rustup toolchain install stable
rustup default stable
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknown --profile release
mv target/wasm32-unknown-unknown/release/usdt_gold.wasm target/usdt_gold.wasm
- name: Publish
uses: ncipollo/release-action@v1
with:
artifacts: "target/usdt_gold.wasm"
token: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run tests

on:
workflow_call:

push:
branches:
- main

pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Rustfmt
run: cargo fmt -- --check
- name: Run unit tests
run: cargo test --verbose
- name: Install NPM dependencies
run: npm install
- name: Build
run: npm run build
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"name": "usdt-gold",
"scripts": {
"prebuild": "rustup target add wasm32-unknown-unknown",
"build": "cargo build --target wasm32-unknown-unknown --release",
"deploy": "./scripts/deploy.sh",
"demo": "./scripts/demo.sh",
"upgrade": "node scripts/upgrade.js"
Expand Down

0 comments on commit 972ac99

Please sign in to comment.