Skip to content
Open
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
2 changes: 2 additions & 0 deletions .github/workflows/migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11.0.11
- name: Log in to Docker Hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Run production migration
env:
MONGO_HOST: ${{ secrets.MONGO_HOST }}
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ on: pull_request_target
jobs:
build:
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:3.2
ports:
- 27017:27017
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Set up JDK 11.0.11
uses: actions/setup-java@v1
with:
java-version: 11.0.11
- name: Log in to Docker Hub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
- name: Run local migration
run: ./gradlew clean run
- uses: kentaro-m/auto-assign-action@v1.1.2
Expand Down
23 changes: 23 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import com.bmuschko.gradle.docker.tasks.container.*

plugins {
id "java"
id "scala"
id "application"
id "cz.alenkacz.gradle.scalafmt" version "1.16.2"
id 'com.bmuschko.docker-remote-api' version '9.0.1'
}

version = '1.0.2'
Expand All @@ -24,3 +27,23 @@ dependencies {
}

compileScala.dependsOn("checkScalafmt")

task createMongoContainer(type: DockerCreateContainer) {
targetImageId 'mongo:3.2'
containerName = 'mongo'
hostConfig.portBindings = ['27017:27017']
hostConfig.autoRemove = true
}

task startMongoContainer(type: DockerStartContainer) {
dependsOn createMongoContainer
targetContainerId createMongoContainer.containerId
}

task stopMongoContainer(type: DockerStopContainer) {
targetContainerId createMongoContainer.containerId
}

run.dependsOn(startMongoContainer)

run.finalizedBy(stopMongoContainer)