Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: use axum #138

Merged
merged 9 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 23 additions & 39 deletions .github/workflows/exporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
pull_request:
branches:
- '*'
- "*"

env:
CARGO_TERM_COLOR: always
Expand All @@ -33,54 +33,40 @@ jobs:
POSTGRES_HOST: localhost
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup .env
run: ./scripts/create_env.sh

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

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

- name: Check Format
uses: actions-rs/cargo@v1
- uses: Swatinem/rust-cache@v2
with:
command: fmt
args: --all -- --check
cache-targets: true

- name: Check Format
run: cargo fmt --all -- --check

- uses: taiki-e/install-action@nextest

- name: Cache sqlx-cli
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-sqlx
with:
path: |
~/.cargo/bin/sqlx
~/.cargo/bin/cargo-sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}
- 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
run: |
cargo install sqlx-cli \
--force \
--version=${{ env.SQLX_VERSION }} \
--features ${{ env.SQLX_FEATURES }} \
--no-default-features \
--locked

- name: Migrate database
Expand All @@ -89,11 +75,9 @@ jobs:
./scripts/init_db.sh

- name: Lint
uses: actions-rs/clippy-check@v1
if: github.actor != 'dependabot[bot]'
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- -D warnings
run: |
cargo clippy -- -D warnings

- name: Check sqlx offline query
if: github.actor != 'dependabot[bot]'
Expand All @@ -120,7 +104,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Exporter Google Sheet Credentials
env:
Expand All @@ -131,19 +115,19 @@ jobs:

- name: Login
id: auth
uses: google-github-actions/auth@v0
uses: google-github-actions/auth@v2
with:
token_format: access_token
workload_identity_provider: ${{ secrets.GCP_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_DEPLOY_SERVICE_ACCOUNT }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
uses: google-github-actions/setup-gcloud@v2
with:
install_components: beta

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Docker Image Metadata
id: meta
Expand All @@ -156,14 +140,14 @@ jobs:
type=sha

- name: Login to GAR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: us-central1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}

- name: Build production image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
provenance: false
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/security-audit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ name: security
on:
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
- "**/Cargo.toml"
- "**/Cargo.lock"
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

jobs:
audit:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
- uses: rustsec/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
107 changes: 40 additions & 67 deletions .github/workflows/server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
pull_request:
branches:
- '*'
- "*"

env:
CARGO_TERM_COLOR: always
Expand All @@ -33,55 +33,41 @@ jobs:
POSTGRES_HOST: localhost
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup .env
run: ./scripts/create_env.sh

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

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
components: rustfmt, clippy
toolchain: stable
override: true
components: llvm-tools-preview

- name: Check Format
uses: actions-rs/cargo@v1
- uses: Swatinem/rust-cache@v2
with:
command: fmt
args: --all -- --check
cache-targets: true

- name: Check Format
run: cargo fmt --all -- --check

- uses: taiki-e/install-action@nextest

- name: Cache sqlx-cli
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-sqlx
with:
path: |
~/.cargo/bin/sqlx
~/.cargo/bin/cargo-sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}
- 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
run: |
cargo install sqlx-cli \
--force \
--version=${{ env.SQLX_VERSION }} \
--features ${{ env.SQLX_FEATURES }} \
--no-default-features \
--locked

- name: Migrate database
Expand All @@ -90,11 +76,9 @@ jobs:
./scripts/init_db.sh

- name: Lint
uses: actions-rs/clippy-check@v1
if: github.actor != 'dependabot[bot]'
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: -- -D warnings
run: |
cargo clippy -- -D warnings

- name: Check sqlx offline query
if: github.actor != 'dependabot[bot]'
Expand All @@ -121,23 +105,23 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Login
id: auth
uses: google-github-actions/auth@v0
uses: google-github-actions/auth@v2
with:
token_format: access_token
workload_identity_provider: ${{ secrets.GCP_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_DEPLOY_SERVICE_ACCOUNT }}

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
uses: google-github-actions/setup-gcloud@v2
with:
install_components: beta

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Docker Image Metadata
id: meta
Expand All @@ -150,14 +134,14 @@ jobs:
type=sha

- name: Login to GAR
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: us-central1-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}

- name: Build production image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
provenance: false
Expand Down Expand Up @@ -195,7 +179,7 @@ jobs:
--set-secrets=APP__BIGCOMMERCE__CLIENT_ID=APP__BIGCOMMERCE__CLIENT_ID:1 \
--set-secrets=APP__APPLICATION__JWT_SECRET=APP__APPLICATION__JWT_SECRET:1 \
--set-secrets=APP__LIQ_PAY__PUBLIC_KEY=APP__LIQ_PAY__PUBLIC_KEY:2 \
--set-secrets=APP__LIQ_PAY__PRIVATE_KEY=APP__LIQ_PAY__PRIVATE_KEY:2
--set-secrets=APP__LIQ_PAY__PRIVATE_KEY=APP__LIQ_PAY__PRIVATE_KEY:2

coverage:
name: coverage
Expand All @@ -219,50 +203,39 @@ jobs:
POSTGRES_HOST: localhost
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup .env
run: ./scripts/create_env.sh

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

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
profile: minimal
toolchain: stable
override: true
components: llvm-tools-preview

- uses: Swatinem/rust-cache@v2
with:
cache-targets: true

- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest

- name: Cache sqlx-cli
uses: actions/cache@v3
uses: actions/cache@v4
id: cache-sqlx
with:
path: |
~/.cargo/bin/sqlx
~/.cargo/bin/cargo-sqlx
key: ${{ runner.os }}-sqlx-${{ env.SQLX_VERSION }}
- 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
run: |
cargo install sqlx-cli \
--force \
--version=${{ env.SQLX_VERSION }} \
--features ${{ env.SQLX_FEATURES }} \
--no-default-features \
--locked

- name: Migrate database
Expand All @@ -276,7 +249,7 @@ jobs:
cargo llvm-cov nextest --all-features --lcov --output-path lcov.info

- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@1.1.3
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: apps/server/lcov.info
file: apps/server/lcov.info
Loading