Skip to content

Commit c0be1be

Browse files
authored
Merge pull request #2 from iotaledger/chore/clippy-test-workflows
Add workflow to check fmt, clippy and run tests
2 parents 9707057 + 5ab83ac commit c0be1be

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 'iota-sandbox-setup'
2+
description: 'Setup IOTA Sandbox'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Setup iota sandbox
7+
shell: bash
8+
run: |
9+
# Use next lines for using the GitHub release
10+
mkdir iota-sandbox
11+
cd iota-sandbox
12+
mkdir sandbox
13+
cd sandbox
14+
# Use the output of https://api.github.com/repos/iotaledger/iota-sandbox/releases/latest
15+
DOWNLOAD_URL=$(curl "https://api.github.com/repos/iotaledger/iota-sandbox/releases" | jq -r '.[0].assets[] | select(.name | contains("iota_sandbox")) | .browser_download_url')
16+
echo "Downloading sandbox from $DOWNLOAD_URL"
17+
curl -L -o iota_sandbox.tar.gz $DOWNLOAD_URL
18+
tar -xf iota_sandbox.tar.gz
19+
20+
# Use the next lines to use the main branch
21+
# git clone https://github.com/iotaledger/iota-sandbox
22+
# cd iota-sandbox/sandbox
23+
24+
# Start Tangle
25+
sudo ./bootstrap.sh
26+
docker compose --profile inx-faucet up -d
27+
- name: Wait for tangle to start
28+
shell: bash
29+
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"
30+
env:
31+
WAIT_FOR_VERSION: 4df3f9262d84cab0039c07bf861045fbb3c20ab7 # v2.2.3
32+
- name: Wait for faucet to start
33+
shell: bash
34+
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"
35+
env:
36+
WAIT_FOR_VERSION: 4df3f9262d84cab0039c07bf861045fbb3c20ab7 # v2.2.3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: 'iota-sandbox-tear-down'
2+
description: 'tear-down a iota sandbox'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Tear down iota sandbox
7+
shell: bash
8+
run: |
9+
cd iota-sandbox/sandbox
10+
docker-compose down
11+
cd ../..
12+
sudo rm -rf iota-sandbox

.github/workflows/clippy.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: clippy & fmt
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [ opened, synchronize, reopened, ready_for_review ]
9+
branches:
10+
- main
11+
12+
jobs:
13+
clippy-and-fmt:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Update local toolchain
18+
run: |
19+
rustup update
20+
rustup component add clippy
21+
- name: Toolchain info
22+
run: |
23+
cargo --version --verbose
24+
rustc --version
25+
cargo clippy --version
26+
- name: Check formatting
27+
run: cargo fmt -- --check
28+
- name: Run clippy
29+
run: cargo clippy -- -D warnings

.github/workflows/run-tests.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
types: [ opened, synchronize, reopened, ready_for_review ]
9+
branches:
10+
- main
11+
12+
jobs:
13+
run-tests:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Update local toolchain
18+
run: |
19+
rustup update
20+
rustup component add clippy
21+
- name: Toolchain info
22+
run: |
23+
cargo --version --verbose
24+
rustc --version
25+
cargo clippy --version
26+
- name: Start iota sandbox
27+
uses: './.github/actions/iota-sandbox/setup'
28+
- name: Run tests
29+
run: cargo test --release
30+
- name: Stop iota sandbox
31+
uses: './.github/actions/iota-sandbox/tear-down'

0 commit comments

Comments
 (0)