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

Add workflow to check fmt, clippy and run tests #2

Merged
merged 2 commits into from
Apr 26, 2024
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
36 changes: 36 additions & 0 deletions .github/actions/iota-sandbox/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 'iota-sandbox-setup'
description: 'Setup IOTA Sandbox'
runs:
using: "composite"
steps:
- name: Setup iota sandbox
shell: bash
run: |
# Use next lines for using the GitHub release
mkdir iota-sandbox
cd iota-sandbox
mkdir sandbox
cd sandbox
# Use the output of https://api.github.com/repos/iotaledger/iota-sandbox/releases/latest
DOWNLOAD_URL=$(curl "https://api.github.com/repos/iotaledger/iota-sandbox/releases" | jq -r '.[0].assets[] | select(.name | contains("iota_sandbox")) | .browser_download_url')
echo "Downloading sandbox from $DOWNLOAD_URL"
curl -L -o iota_sandbox.tar.gz $DOWNLOAD_URL
tar -xf iota_sandbox.tar.gz

# Use the next lines to use the main branch
# git clone https://github.com/iotaledger/iota-sandbox
# cd iota-sandbox/sandbox

# Start Tangle
sudo ./bootstrap.sh
docker compose --profile inx-faucet up -d
- name: Wait for tangle to start
shell: bash
run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- -t 60 http://localhost/health -- echo "Tangle is up"
env:
WAIT_FOR_VERSION: 4df3f9262d84cab0039c07bf861045fbb3c20ab7 # v2.2.3
- name: Wait for faucet to start
shell: bash
run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- -t 60 http://localhost/faucet/api/info -- echo "Faucet is up"
env:
WAIT_FOR_VERSION: 4df3f9262d84cab0039c07bf861045fbb3c20ab7 # v2.2.3
12 changes: 12 additions & 0 deletions .github/actions/iota-sandbox/tear-down/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'iota-sandbox-tear-down'
description: 'tear-down a iota sandbox'
runs:
using: "composite"
steps:
- name: Tear down iota sandbox
shell: bash
run: |
cd iota-sandbox/sandbox
docker-compose down
cd ../..
sudo rm -rf iota-sandbox
29 changes: 29 additions & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: clippy & fmt

on:
push:
branches:
- main
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
branches:
- main

jobs:
clippy-and-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update local toolchain
run: |
rustup update
rustup component add clippy
- name: Toolchain info
run: |
cargo --version --verbose
rustc --version
cargo clippy --version
- name: Check formatting
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy -- -D warnings
31 changes: 31 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run tests

on:
push:
branches:
- main
pull_request:
types: [ opened, synchronize, reopened, ready_for_review ]
branches:
- main

jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Update local toolchain
run: |
rustup update
rustup component add clippy
- name: Toolchain info
run: |
cargo --version --verbose
rustc --version
cargo clippy --version
- name: Start iota sandbox
uses: './.github/actions/iota-sandbox/setup'
- name: Run tests
run: cargo test --release
- name: Stop iota sandbox
uses: './.github/actions/iota-sandbox/tear-down'
Loading