From 0ba6e9e29477268dae9e456dac55111eb11ade57 Mon Sep 17 00:00:00 2001 From: Cory Forsstrom Date: Mon, 15 Apr 2024 14:46:27 -0700 Subject: [PATCH] Add CI --- .github/CODEOWNERS | 1 + .github/FUNDING.yml | 3 ++ .github/dependabot.yml | 15 ++++++++++ .github/workflows/ci.yaml | 55 ++++++++++++++++++++++++++++++++++++ .github/workflows/pages.yaml | 50 ++++++++++++++++++++++++++++++++ 5 files changed, 124 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/FUNDING.yml create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/pages.yaml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..1f9e503 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @ikeycode @ermo @tarkah diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..d9f596c --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: [ikeycode] diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ec32784 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "cargo" + directory: "/" + schedule: + interval: "weekly" + day: "tuesday" + time: "10:00" + timezone: "Europe/London" + groups: + cargo: + patterns: + - "*" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..362920f --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,55 @@ +name: CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + schedule: + - cron: '30 2 * * *' + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + runs-on: ubuntu-latest + name: Build & Test Project + + steps: + - name: Checkout source + uses: actions/checkout@v4 + + - name: typos-action + uses: crate-ci/typos@v1.20.8 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Check Formatting + run: cargo fmt --all -- --check + + - name: Cargo Cache + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Build project + run: cargo build + + - name: Test project + run: cargo test --all + + - name: Run clippy + uses: giraffate/clippy-action@v1 + with: + reporter: 'github-pr-check' + clippy_flags: --workspace --no-deps + filter_mode: nofilter + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml new file mode 100644 index 0000000..0ac2ee3 --- /dev/null +++ b/.github/workflows/pages.yaml @@ -0,0 +1,50 @@ +name: Deploy pages +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + - name: Configure cache + uses: Swatinem/rust-cache@v2 + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Clean docs folder + run: cargo clean --doc + - name: Build docs + run: cargo doc --workspace --no-deps + - name: Add redirect + run: echo '' > target/doc/index.html + - name: Remove lock file + run: rm target/doc/.lock + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: target/doc + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4