Skip to content

Commit

Permalink
add github workflow(fix #17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fred0327 committed Oct 10, 2023
1 parent 157f28a commit e1641e2
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 1 deletion.
106 changes: 106 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: ci

on:
pull_request:
branches:
- main
push:
branches:
- main
- issue*

jobs:
fmt:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt
override: true
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

# sort the dependencies in Cargo.toml
cargo_sort:
name: cargo sort
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: baptiste0928/cargo-install@v2
with:
crate: cargo-sort
version: latest
- run: cargo sort -c

# check cargo.toml format
taplo_fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: baptiste0928/cargo-install@v2
with:
crate: taplo-cli
version: latest
- run: taplo check

# check unused dependency
cargo_machete:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: baptiste0928/cargo-install@v2
with:
crate: cargo-machete
version: latest
- run: cargo-machete

clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all --all-features -- -D warnings

build:
name: cargo build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/cargo@v1
with:
command: build

go_binding:
name: golang binding build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: baptiste0928/cargo-install@v2
with:
crate: uniffi-bindgen-go
git: https://github.com/NordSecurity/uniffi-bindgen-go
tag: "v0.1.2+v0.23.0"
# golang test
- uses: actions/setup-go@v4
with:
go-version: 1.20
- run: make test_go

test:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/cargo@v1
with:
command: test
args: --all
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ BINDINGS_DIR_EXAMPLE:=${ROOT_DIR}/examples/Golang/generated
LD_LIBRARY_PATH := ${LD_LIBRARY_PATH}:${LIB_DIR}
BINDINGS_DIR?="${ROOT_DIR}/binding_tests/generated"
UNIFFI_VERSION=0.23.0
UNIFFI_BINDGEN_GO_VERSION=v0.1.3+v${UNIFFI_VERSION}
UNIFFI_BINDGEN_GO_VERSION=v0.1.5+v${UNIFFI_VERSION}

prepare_ffi:
@if [[ `uniffi-bindgen-go -V | grep 'v.${UNIFFI_VERSION}'` ]]; then \
Expand Down

0 comments on commit e1641e2

Please sign in to comment.