Skip to content

Merge pull request #4 from nipsysdev/ci/add_workflows #1

Merge pull request #4 from nipsysdev/ci/add_workflows

Merge pull request #4 from nipsysdev/ci/add_workflows #1

Workflow file for this run

name: Publish
on:
push:
tags:
- "v*"
branches:
- main
workflow_dispatch:
env:
cache_nonce: 0
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Cache prebuilt binaries
uses: actions/cache@v4
with:
path: ~/.cache/storage-bindings
key: storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ env.cache_nonce }}
restore-keys: |
storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-
storage-bindings-${{ runner.os }}-
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang libclang-dev
- name: Install mise
uses: jdx/mise-action@v3
with:
enable: true
cache: true
- name: Run cargo build
run: cargo build --all-features --release
lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 30
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Cache prebuilt binaries
uses: actions/cache@v4
with:
path: ~/.cache/storage-bindings
key: storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ env.cache_nonce }}
restore-keys: |
storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-
storage-bindings-${{ runner.os }}-
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang libclang-dev
- name: Install mise
uses: jdx/mise-action@v3
with:
enable: true
cache: true
- name: Install rustfmt and clippy
run: rustup component add rustfmt clippy
- name: Run cargo check
run: cargo check --all-targets --all-features
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 30
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Cache prebuilt binaries
uses: actions/cache@v4
with:
path: ~/.cache/storage-bindings
key: storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ env.cache_nonce }}
restore-keys: |
storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-
storage-bindings-${{ runner.os }}-
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang libclang-dev
- name: Install mise
uses: jdx/mise-action@v3
with:
enable: true
cache: true
- name: Run cargo test
run: cargo test --all-features
env:
TZ: UTC
publish:
name: Publish
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [lint, test, build]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Cache prebuilt binaries
uses: actions/cache@v4
with:
path: ~/.cache/storage-bindings
key: storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ env.cache_nonce }}
restore-keys: |
storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-
storage-bindings-${{ runner.os }}-
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang libclang-dev
- name: Install mise
uses: jdx/mise-action@v3
with:
enable: true
cache: true
- name: Login to crates.io
run: echo "${{ secrets.CRATES_API_TOKEN }}" | cargo login
- name: Publish to crates.io
run: cargo publish --all-features