Skip to content

Commit

Permalink
Implement Paperclip to provide OpenAPI spec documents
Browse files Browse the repository at this point in the history
Co-authored-by: Alcibiades Athens <alcibiades.eth@protonmail.com>
  • Loading branch information
perpetuum7 and 0xAlcibiades authored Dec 1, 2022
1 parent ce41c88 commit 95affb6
Show file tree
Hide file tree
Showing 10 changed files with 1,324 additions and 451 deletions.
121 changes: 108 additions & 13 deletions .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
types: [ opened, synchronize, reopened ]
branches:
- master

Expand All @@ -22,25 +22,68 @@ jobs:
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
POSTGRES_DB: quay
ports:
- 5432:5432
redis:
image: redis:6
ports:
- 6379:6379
env:
SQLX_VERSION: 0.5.7
SQLX_FEATURES: postgres
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- name: Checkout repository
uses: actions/checkout@v2

- name: Cache dependencies
id: cache-dependencies
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

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

- name: Cache sqlx-cli
uses: actions/cache@v2
id: cache-sqlx
with:
path: |
~/.cargo/bin/sqlx
~/.cargo/bin/cargo-sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}-${{ env.SQLX_FEATURES }}

- name: Install sqlx-cli
uses: actions-rs/cargo@v1
if: steps.cache-sqlx.outputs.cache-hit == false
with:
command: install
args: >
sqlx-cli
--force
--version=${{ env.SQLX_VERSION }}
--features=${{ env.SQLX_FEATURES }}
--no-default-features
--locked
- name: Migrate database
run: |
sudo apt-get install libpq-dev -y
cargo install --version=0.5.7 sqlx-cli --no-default-features --features postgres
SKIP_DOCKER=true ./scripts/init_db.sh
- name: Check sqlx-data.json is up-to-date
run: |
cargo sqlx prepare --merged -- --lib --tests
env:
DATABASE_URL: postgres://postgres:password@localhost:5432/quay
- uses: actions-rs/cargo@v1
env:
APP_RPC__URI: ${{ secrets.APP_RPC__URI }}
Expand Down Expand Up @@ -71,22 +114,51 @@ jobs:
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
POSTGRES_DB: quay
ports:
- 5432:5432
env:
SQLX_VERSION: 0.5.7
SQLX_FEATURES: postgres
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- name: Checkout repository
uses: actions/checkout@v2

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

- name: Cache sqlx-cli
uses: actions/cache@v2
id: cache-sqlx
with:
path: |
~/.cargo/bin/sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}-${{ env.SQLX_FEATURES }}

- name: Install sqlx-cli
uses: actions-rs/cargo@v1
if: steps.cache-sqlx.outputs.cache-hit == false
with:
command: install
args: >
sqlx-cli
--force
--version=${{ env.SQLX_VERSION }}
--features=${{ env.SQLX_FEATURES }}
--no-default-features
--locked
- name: Migrate database
run: |
sudo apt-get install libpq-dev -y
cargo install --version=0.5.7 sqlx-cli --no-default-features --features postgres
SKIP_DOCKER=true ./scripts/init_db.sh
- uses: actions-rs/clippy-check@v1
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- -D warnings
Expand All @@ -100,13 +172,16 @@ jobs:
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: postgres
POSTGRES_DB: quay
ports:
- 5432:5432
redis:
image: redis:6
ports:
- 6379:6379
env:
SQLX_VERSION: 0.5.7
SQLX_FEATURES: postgres
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -117,10 +192,30 @@ jobs:
toolchain: stable
override: true

- name: Cache sqlx-cli
uses: actions/cache@v2
id: cache-sqlx
with:
path: |
~/.cargo/bin/sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}-${{ env.SQLX_FEATURES }}

- name: Install sqlx-cli
uses: actions-rs/cargo@v1
if: steps.cache-sqlx.outputs.cache-hit == false
with:
command: install
args: >
sqlx-cli
--force
--version=${{ env.SQLX_VERSION }}
--features=${{ env.SQLX_FEATURES }}
--no-default-features
--locked
- name: Migrate database
run: |
sudo apt-get install libpq-dev -y
cargo install --version=0.5.7 sqlx-cli --no-default-features --features postgres
SKIP_DOCKER=true ./scripts/init_db.sh
- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
Expand Down
Loading

0 comments on commit 95affb6

Please sign in to comment.