Skip to content

Commit

Permalink
migrate db
Browse files Browse the repository at this point in the history
  • Loading branch information
cycle-five committed Aug 6, 2023
1 parent ab48490 commit b46f4ec
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 14 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ jobs:
- name: Cache
uses: Swatinem/rust-cache@v1

- name: Migrate database
env:
DATABASE_URL: sqlite://./data/crackedmusic.db
run: |
cargo install sqlx-cli --no-default-features --features postgres,sqlite
sqlx database create
sqlx migrate --source migrations/ run
cargo sqlx prepare -- --tests
- name: Build Binary
run: cargo build --locked

Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ jobs:
steps:
- name: Repository Checkout
uses: actions/checkout@v3

-
name: Migrate database
run: |
cargo install sqlx-cli --no-default-features --features postgres,sqlite,runtime-tokio,tls-rustls,macros,sqlite,postgres,chrono
sqlx database create
sqlx migrate --source migrations/ run
cargo sqlx prepare -- --tests
- name: Build Docker Image
run: docker build . -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
Expand All @@ -49,6 +58,18 @@ jobs:
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}

-
name: Migrate database
env:
DATABASE_URL: sqlite://./data/crackedmusic.db
run: |
cargo install sqlx-cli --no-default-features --features sqlite,postgres
sqlx database create
sqlx migrate --source migrations/ run
cargo sqlx prepare -- --tests
- name: Build & Push Docker Image
uses: docker/build-push-action@v4
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ on:
push:
tags: ['v*.*.*']
branches: [master]
pull_request:
branches: [master]

workflow_call:

env:
Expand All @@ -29,6 +26,15 @@ jobs:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Migrate database
env:
DATABASE_URL: sqlite://./data/crackedmusic.db
run: |
cargo install sqlx-cli --no-default-features --features postgres,sqlite
sqlx database create
sqlx migrate --source migrations/ run
cargo sqlx prepare -- --tests
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
Expand All @@ -43,14 +49,4 @@ jobs:
uses: docker/build-push-action@v4
with:
push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
tags: ${{ env.IMAGE_NAME }}:${{ github.sha }}
build:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
tags: ${{ env.IMAGE_NAME }}:${{ github.sha }}
9 changes: 9 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ jobs:

- name: Cache
uses: Swatinem/rust-cache@v1

- name: Migrate database
env:
DATABASE_URL: sqlite://./data/crackedmusic.db
run: |
cargo install sqlx-cli --no-default-features --features postgres,sqlite
sqlx database create
sqlx migrate --source migrations/ run
cargo sqlx prepare -- --tests
- name: Run clippy
uses: actions-rs/clippy-check@v1
Expand Down

0 comments on commit b46f4ec

Please sign in to comment.