diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7b710f3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,86 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +# Clippy action needs the write permission. +permissions: + checks: write + +jobs: + format: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + components: rustfmt + + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --check + + - name: Setup pnpm + uses: pnpm/action-setup@v2.2.4 + + - name: Setup node + uses: actions/setup-node@v3 + with: + node-version-file: ".nvmrc" + + - run: pnpm install --frozen-lockfile + - name: Run prettier + run: |- + pnpm format:check + + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + components: clippy + + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features + + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all-features + + test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + + - uses: actions-rs/cargo@v1 + with: + command: test