From 17bbe960ce3ce4b7a53b554188b1f6e33cca1a58 Mon Sep 17 00:00:00 2001 From: Weiliang Li Date: Wed, 9 Dec 2020 13:31:02 +0900 Subject: [PATCH] github actions (#52) * github actions * fix check * clean * fix cd --- .circleci/config.yml | 121 --------------------------------------- .github/workflows/cd.yml | 45 +++++++++++++++ .github/workflows/ci.yml | 74 ++++++++++++++++++++++++ README.md | 2 +- 4 files changed, 120 insertions(+), 122 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 01a6bf8..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,121 +0,0 @@ -version: 2.1 - -defaults: &defaults - docker: - - image: rust - -jobs: - test: &test-template - <<: *defaults - steps: - - checkout - - run: - name: Version information - command: rustc --version; cargo --version; rustup --version - - run: - name: Calculate dependencies - command: cargo generate-lockfile - - restore_cache: - keys: - - v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} - - v4-cargo-cache- - - run: - name: Build tests - command: cargo test --no-default-features --features pure --no-run - - save_cache: - paths: - - /usr/local/cargo/registry - - target/debug/.fingerprint - - target/debug/build - - target/debug/deps - key: v4-cargo-cache-{{ arch }}-{{ checksum "Cargo.lock" }} - - run: - name: Run pure rust tests - command: cargo test --no-default-features --features pure - - run: - name: Run openssl rust tests - command: cargo test --no-default-features --features openssl - - test-beta: - <<: *test-template - docker: - - image: instrumentisto/rust:beta - - test-nightly: - <<: *test-template - docker: - - image: rustlang/rust:nightly - - test-wasm: - docker: - - image: cimg/rust:1.48.0-node - steps: - - checkout - - run: - name: Install openssl - command: sudo apt-get update -y && sudo apt-get -y install pkg-config libssl-dev - - run: - name: Calculate dependencies - command: cargo generate-lockfile - - restore_cache: - keys: - - v4-cargo-cache-wasm-{{ arch }}-{{ checksum "Cargo.lock" }} - - v4-cargo-cache-wasm- - - run: - name: Install wasm dep - command: rustup target add wasm32-unknown-unknown; cargo install wasm-bindgen-cli - - run: - name: Build wasm test - command: cargo test --no-default-features --features pure --target=wasm32-unknown-unknown --no-run - - save_cache: - paths: - - ~/.cargo/registry - - target/debug/.fingerprint - - target/debug/build - - target/debug/deps - key: v4-cargo-cache-wasm-{{ arch }}-{{ checksum "Cargo.lock" }} - - run: - name: Run wasm test - command: cargo test --no-default-features --features pure --target=wasm32-unknown-unknown - - deploy: - <<: *defaults - steps: - - checkout - - run: - name: Set token - command: cargo login $CARGO_DEPLOY_TOKEN - - run: - name: Publish package - command: cargo publish - -workflows: - version: 2 - test-deploy: - jobs: - - test: - filters: - tags: - only: /^v.*/ - - test-beta: - filters: - tags: - only: /^v.*/ - - test-nightly: - filters: - tags: - only: /^v.*/ - - test-wasm: - filters: - tags: - only: /^v.*/ - - deploy: - requires: - - test - - test-wasm - - test-beta - filters: - tags: - only: /^v.*/ - branches: - ignore: /.*/ diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..86c69b5 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,45 @@ +name: Publish + +on: + release: + types: [created] + +env: + CARGO_TERM_COLOR: always + +jobs: + publish: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + target: wasm32-unknown-unknown + - uses: actions/setup-node@v1 + with: + node-version: 14 + - uses: actions-rs/cargo@v1 + with: + command: generate-lockfile + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ~/.cargo/bin + target + key: ${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install wasm dep + run: cargo install wasm-bindgen-cli || true + - name: Run openssl tests + run: cargo test + - name: Run pure rust tests + run: cargo test --no-default-features --features pure + - name: Run wasm tests + run: cargo test --no-default-features --features pure --target=wasm32-unknown-unknown + - name: Publish cargo package + run: cargo login $CARGO_LOGIN_TOKEN && cargo publish + env: + CARGO_LOGIN_TOKEN: ${{ secrets.CARGO_LOGIN_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0dc3fe9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +name: Build + +on: + push: + branches: [master] + + pull_request: + branches: [master] + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + target: wasm32-unknown-unknown + components: rustfmt, clippy + - uses: actions-rs/cargo@v1 + with: + command: generate-lockfile + - uses: actions/cache@v2 + with: + path: | + target + key: ${{ runner.os }}-lint-${{ hashFiles('**/Cargo.lock') }} + - uses: actions-rs/cargo@v1 + with: + command: check + - uses: actions-rs/cargo@v1 + with: + command: fmt + - uses: actions-rs/cargo@v1 + with: + command: clippy + + build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + target: wasm32-unknown-unknown + - uses: actions/setup-node@v1 + with: + node-version: 14 + - uses: actions-rs/cargo@v1 + with: + command: generate-lockfile + - uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ~/.cargo/bin + target + key: ${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install wasm dep + run: cargo install wasm-bindgen-cli || true + - name: Run openssl tests + run: cargo test + - name: Run pure rust tests + run: cargo test --no-default-features --features pure + - name: Run wasm tests + run: cargo test --no-default-features --features pure --target=wasm32-unknown-unknown + - name: Check cargo package + run: cargo publish --dry-run diff --git a/README.md b/README.md index 2834ed3..ec1c586 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/1c6d6ed949dd4836ab97421039e8be75)](https://www.codacy.com/app/ecies/rs) [![License](https://img.shields.io/github/license/ecies/rs.svg)](https://github.com/ecies/rs) -[![Circle CI](https://img.shields.io/circleci/project/ecies/rs/master.svg)](https://circleci.com/gh/ecies/rs) +[![CI](https://github.com/ecies/rs/workflows/Build/badge.svg)](https://github.com/ecies/rs/actions) [![Crates](https://img.shields.io/crates/v/ecies)](https://crates.io/crates/ecies) [![Doc](https://docs.rs/ecies/badge.svg)](https://docs.rs/ecies/latest/ecies/)