From 067e0085c291cdcc66d96ebc05a598f3a97d822a Mon Sep 17 00:00:00 2001 From: realaravinth Date: Fri, 29 Oct 2021 20:27:34 +0530 Subject: [PATCH] setup CI --- .github/FUNDING.yml | 12 +++++++ .github/workflows/clippy-fmt.yml | 43 +++++++++++++++++++++++ .github/workflows/coverage.yml | 53 ++++++++++++++++++++++++++++ .github/workflows/linux.yml | 60 ++++++++++++++++++++++++++++++++ 4 files changed, 168 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/clippy-fmt.yml create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/linux.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..fc20bf9 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +# github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +# patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +# ko_fi: # Replace with a single Ko-fi username +# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: realaravinth +issuehunt: # Replace with a single IssueHunt username +# otechie: # Replace with a single Otechie username +custom: ['https://batsense.net/donate'] diff --git a/.github/workflows/clippy-fmt.yml b/.github/workflows/clippy-fmt.yml new file mode 100644 index 0000000..325e539 --- /dev/null +++ b/.github/workflows/clippy-fmt.yml @@ -0,0 +1,43 @@ +name: Lint + +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: + - master + +jobs: + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt + - name: Check with rustfmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + override: true + + - name: Check with Clippy + uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --workspace --tests --all-features diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..1b136ab --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,53 @@ +name: Coverage + +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: + - master + +jobs: + build_and_test: + strategy: + fail-fast: false + matrix: + version: + - stable + + name: ${{ matrix.version }} - x86_64-unknown-linux-gnu + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: ⚡ Cache + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Install ${{ matrix.version }} + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu + profile: minimal + override: true + + - name: Generate coverage file + if: matrix.version == 'stable' && (github.ref == 'refs/heads/master' || github.event_name == 'pull_request') + uses: actions-rs/tarpaulin@v0.1 + with: + version: '0.18.2' + args: '-t 1200' + env: + # GIT_HASH is dummy value. I guess build.rs is skipped in tarpaulin + # execution so this value is required for preventing meta tests from + # panicking + GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 + + - name: Upload to Codecov + if: matrix.version == 'stable' && (github.ref == 'refs/heads/master' || github.event_name == 'pull_request') + uses: codecov/codecov-action@v1 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..ed00be5 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,60 @@ +name: Build + +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: + - master + +jobs: + build_and_test: + strategy: + fail-fast: false + matrix: + version: + #- 1.51.0 + - stable + # - nightly + + name: ${{ matrix.version }} - x86_64-unknown-linux-gnu + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: ⚡ Cache + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + + - name: Install ${{ matrix.version }} + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu + profile: minimal + override: true + + - name: build + run: make + + - name: run tests + run: make test + + - name: generate documentation + if: matrix.version == 'stable' && (github.repository == 'realaravinth/pages') + run: make doc + env: + GIT_HASH: 8e77345f1597e40c2e266cb4e6dee74888918a61 # dummy value + + - name: Deploy to GitHub Pages + if: matrix.version == 'stable' && (github.repository == 'realaravinth/pages') + uses: JamesIves/github-pages-deploy-action@3.7.1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: target/doc