Skip to content

Commit

Permalink
ci: tests and deploy actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ilbertt committed Dec 19, 2024
1 parent e2f5f97 commit cc71c4f
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/actions/setup-dfx/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Setup DFX
description: Setup DFX

runs:
using: 'composite'
steps:
- name: Setup DFX
uses: dfinity/setup-dfx@main
with:
dfx-version: 'auto'
18 changes: 18 additions & 0 deletions .github/actions/setup-rust/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Setup Rust
description: Setup Rust
inputs:
cache-key:
description: "The key to use for caching"
required: true

runs:
using: "composite"
steps:
- name: Install Rust toolchain
shell: bash
run: rustup show

- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ inputs.cache-key }}
28 changes: 28 additions & 0 deletions .github/workflows/mainnet-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Mainnet deploy

on: workflow_dispatch

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 2

- uses: ./.github/actions/setup-rust
with:
cache-key: "build-wasm"

- uses: ./.github/actions/setup-dfx

- name: Import DFX identity
run: |
echo "${{ secrets.MAINNET_PEM }}" > ./mainnet.pem
dfx identity import --ic --storage-mode plaintext mainnet ./mainnet.pem
dfx identity use mainnet
- name: Deploy to mainnet
run: dfx deploy --ic
28 changes: 28 additions & 0 deletions .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Rust tests

on:
push:
branches:
- main
pull_request:

jobs:
rust_tests:
name: Rust tests
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4

- uses: ./.github/actions/setup-rust
with:
cache-key: "tests"

- name: Cargo fmt
run: cargo fmt -- --check

- name: Cargo clippy
run: cargo clippy --all-targets --all-features --workspace -- -Dwarnings

- name: Cargo test
run: cargo test

0 comments on commit cc71c4f

Please sign in to comment.