Skip to content

Commit

Permalink
Added CI (#5)
Browse files Browse the repository at this point in the history
* Added CI

* Install sqlx and setup the sqlite database

* Added `rustls` to the sqlx installer

* Switched to `cargo-install` so the binaries can be cached between builds

* Updated dependabot to also update the github-actions

* Fixed wrong cargo package being installed
  • Loading branch information
VictorKoenders authored Oct 18, 2022
1 parent 3c8f261 commit 65eef13
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ updates:
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
63 changes: 63 additions & 0 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
on: [push]

name: Lint & clippy

jobs:
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
strategy:
matrix:
runtime: [async-std]
front: [terminal]

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: clippy

- name: Install sqlx
uses: baptiste0928/cargo-install@v1
with:
crate: sqlx-cli
version: 0.6
features: sqlite,rustls
args: --no-default-features

- name: Setup database
run: |
echo "DATABASE_URL=sqlite://database.db" >> .env
sqlx database setup --source data/sqlite/migrations
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --features runtime-${{ matrix.runtime }},data-sqlite,front-${{ matrix.front }} -- -D warnings
40 changes: 40 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
on: [push]

name: build

jobs:
test:
name: Test
runs-on: ubuntu-latest

strategy:
matrix:
runtime: [async-std]
front: [terminal]

steps:
- uses: actions/checkout@v2
- name: Install latest stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install sqlx
uses: baptiste0928/cargo-install@v1
with:
crate: sqlx-cli
version: 0.6
features: sqlite,rustls
args: --no-default-features

- name: Setup database
run: |
echo "DATABASE_URL=sqlite://database.db" >> .env
sqlx database setup --source data/sqlite/migrations
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --features runtime-${{ matrix.runtime }},data-sqlite,front-${{ matrix.front }}

0 comments on commit 65eef13

Please sign in to comment.