Switch to Postgres (#39)

* WIP Switch to Postgres

* feat(postgres): more work on porting to postgres, now compiles

* feat(docker-compose): Changed the docker-compose.yml file to use postgres.

* Update docker, documentation, gh actions...

* Remove bson dependency

* Remove bson import

* feat: move mock filehost to trait rather than cargo feature

* feat(postgres): transactions for mod creation, multipart refactor

* fix: Add Cargo.lock so that sqlx functions

* Update sqlx offline build data

* fix: Use SQLX_OFFLINE to force sqlx into offline mode for CI

* Default release channels

* feat(postgres): refactor database models to fit postgres models

* fix: Fix sqlx prepare, fix double allocation in indexing

* Add dockerfile (#40)

Co-authored-by: Charalampos Fanoulis <charalampos.fanoulis@gmail.com>

Co-authored-by: Aeledfyr <aeledfyr@gmail.com>
Co-authored-by: redblueflame <contact@redblueflame.com>
Co-authored-by: Jai A <jai.a@tuta.io>
Co-authored-by: Valentin Ricard <redblueflame1@gmail.Com>
Co-authored-by: Charalampos Fanoulis <charalampos.fanoulis@gmail.com>
This commit is contained in:
AppleTheGolden
2020-07-23 22:46:33 +02:00
committed by GitHub
parent 95339a8338
commit ee69653a83
47 changed files with 4363 additions and 694 deletions

View File

@@ -7,6 +7,7 @@ on:
env:
CARGO_TERM_COLOR: always
SQLX_OFFLINE: true
jobs:
lint:
@@ -30,3 +31,5 @@ jobs:
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
env:
SQLX_OFFLINE: true

View File

@@ -0,0 +1,25 @@
name: Docker image build
on:
push:
branches:
- master
env:
CARGO_TERM_COLOR: always
SQLX_OFFLINE: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: modrinth/labrinth/labrinth
tag_with_ref: false
tags: master
tag_with_sha: true

View File

@@ -0,0 +1,26 @@
name: Docker image build
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
env:
CARGO_TERM_COLOR: always
SQLX_OFFLINE: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: modrinth/labrinth/labrinth
tag_with_ref: true
tags: latest
tag_with_sha: true

25
.github/workflows/docker-compile.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Docker image build
on:
push:
branches:
- !master
pull_request:
env:
CARGO_TERM_COLOR: always
SQLX_OFFLINE: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: modrinth/labrinth/labrinth
tag_with_ref: true
tag_with_sha: true

View File

@@ -5,7 +5,7 @@ on:
label:
push:
branches:
- maser
- master
paths:
- '.github/labels.yml'

View File

@@ -7,6 +7,7 @@ on:
env:
CARGO_TERM_COLOR: always
SQLX_OFFLINE: true
jobs:
build:
@@ -25,7 +26,11 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: stable
env:
SQLX_OFFLINE: true
- uses: actions-rs/cargo@v1
name: Build program
with:
command: build
env:
SQLX_OFFLINE: true

View File

@@ -2,20 +2,27 @@ name: Unit Tests
on:
push:
branches: [ master ]
branches: [master]
pull_request:
env:
CARGO_TERM_COLOR: always
SQLX_OFFLINE: true
jobs:
test:
name: ${{ matrix.os }}-rust-${{ matrix.rust }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error }}
strategy:
matrix:
os: [ubuntu-latest]
rust:
- stable
- beta
- nightly
rust: [beta, nightly]
continue-on-error: [true]
include:
- os: ubuntu-latest
- rust: stable
- continue-on-error: false
steps:
- uses: actions/checkout@v2
@@ -34,10 +41,13 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: build
env:
SQLX_OFFLINE: true
- uses: actions-rs/cargo@v1
with:
command: test
env:
BACKBLAZE_BUCKET_ID: ${{ secrets.BACKBLAZE_BUCKET_ID }}
BACKBLAZE_KEY: ${{ secrets.BACKBLAZE_KEY }}
BACKBLAZE_KEY_ID: ${{ secrets.BACKBLAZE_KEY_ID }}
BACKBLAZE_KEY_ID: ${{ secrets.BACKBLAZE_KEY_ID }}
SQLX_OFFLINE: true