Skip to content

Commit

Permalink
chore: initial CI setup
Browse files Browse the repository at this point in the history
  • Loading branch information
zvolin committed Aug 11, 2023
1 parent 1b19410 commit 221903b
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 3 deletions.
3 changes: 0 additions & 3 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
[build]
target = "wasm32-unknown-unknown"

[test]
target = "x86_64-unknown-linux-gnu"
76 changes: 76 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: CI

on:
push:
branches:
- main
pull_request:

jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Run format
run: cargo fmt -- --check

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Set up cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys:
cargo-${{ hashFiles('**/Cargo.lock') }}
cargo-

- name: Run clippy
run: cargo clippy --all -- -D warnings

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Set up dfx
uses: aviate-labs/[email protected]
with:
dfx-version: 0.14.3

- name: Set up cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys:
cargo-${{ hashFiles('**/Cargo.lock') }}
cargo-

- name: Build wasm
run: cargo build --release

- name: Run tests
env:
# generated with:
# dfx identity new gh_action --storage-mode plaintext
# dfx identity export gh_action
DFX_IDENTITY_PEM=${{ secrets.GH_ACTION_IDENTITY_PEM }}
run: |
dfx identity use gh_action
dfx start --background --artificial-delay 5 --clean
cargo test --target x86_64-unknown-linux-gnu

0 comments on commit 221903b

Please sign in to comment.