Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCizmar committed Feb 4, 2021
2 parents ce84ead + 54fdfe2 commit bbae391
Show file tree
Hide file tree
Showing 405 changed files with 31,236 additions and 1,001 deletions.
1 change: 0 additions & 1 deletion .buildversions

This file was deleted.

9 changes: 8 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,11 @@ updates:
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
open-pull-requests-limit: 20
target-branch: develop
- package-ecosystem: npm
directory: "/webapp/"
schedule:
interval: daily
open-pull-requests-limit: 20
target-branch: develop
62 changes: 19 additions & 43 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Prerelease
on:
push:
branches:
- 'prerelease-*'
- 'main'

jobs:
main:
Expand All @@ -16,55 +16,30 @@ jobs:
java-version: 11

- name: Build with Gradle
run: WEBAPP_PATH=./webapp ./gradlew build

- name: Clone webapp
run: |
source .buildversions
git clone --depth 1 --branch ${WEBAPP_VERSION} https://github.com/polygloat/webapp.git
run: ./gradlew build

- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Run E2E test
run: ./gradlew runE2e

- name: Set git globals
run: |
git config --local user.email "machine@polygloat.io"
git config --local user.name "Polygloat Machine"
git config --local user.email "machine@tolgee.io"
git config --local user.name "Tolgee Machine"
- name: Increase npm version
id: version
run: echo ::set-output name=VERSION::$(npm version prerelease)

- name: Npm install
run: npm install
working-directory: ./webapp

- name: Build webapp
run: npm run build
working-directory: ./webapp

- run: ./gradlew docker
- name: Create docker image
run: ./gradlew docker
env:
WEBAPP_PATH: ./webapp
VERSION: ${{ steps.version.outputs.VERSION }}

- name: Start docker stack
run: docker run -d --name polygloat -e polygloat.internal.populate=true -e polygloat.internal.controller-enabled=true -p8080:8080 polygloat/polygloat

- name: Wait for running container
run: 'until docker logs --since 5m polygloat | grep -m 1 "started on port(s): 8080"; do : ;done'

- name: Run cypress tests
run: |
export CYPRESS_DEFAULT_PASSWORD=$(docker exec polygloat cat /data/initial.pwd)
npm run cy:run
working-directory: ./webapp
env:
CYPRESS_HOST: http://localhost:8080
CYPRESS_API_URL: http://localhost:8080/api/

- name: Push changes
uses: ad-m/github-push-action@master
with:
Expand All @@ -90,26 +65,27 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/polygloat-${{ steps.version.outputs.VERSION }}.jar
asset_name: polygloat-${{ steps.version.outputs.VERSION }}.jar
asset_path: ./build/libs/tolgee-${{ steps.version.outputs.VERSION }}.jar
asset_name: tolgee-${{ steps.version.outputs.VERSION }}.jar
asset_content_type: application/java-archive

- name: Login to docker
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p "${{ secrets.DOCKERHUB_PASSWORD }}"
- name: Tag the image
run: |
docker tag polygloat/polygloat polygloat/polygloat:${{ steps.version.outputs.VERSION }}
docker tag polygloat/polygloat polygloat/polygloat:latest
docker tag tolgee/tolgee tolgee/tolgee:${{ steps.version.outputs.VERSION }}
docker tag tolgee/tolgee tolgee/tolgee:latest
- name: Publish docker image
run: |
docker push polygloat/polygloat:${{ steps.version.outputs.VERSION }}
docker push polygloat/polygloat:latest
docker push tolgee/tolgee:${{ steps.version.outputs.VERSION }}
docker push tolgee/tolgee:latest
- uses: actions/upload-artifact@v2
if: always()
with:
name: cypress
name: test
path: |
./webapp/cypress/videos/**/*
./webappcypress/screenshots/**/*
./e2e/cypress/videos/**/*
./e2e/screenshots/**/*
./build/reports/**/*
42 changes: 8 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Test
on:
push:
branches-ignore:
"prerelease-*"
"main"

jobs:
main:
Expand All @@ -16,47 +16,21 @@ jobs:
java-version: 11

- name: Build with Gradle
run: WEBAPP_PATH=./webapp ./gradlew build

- name: Clone webapp
run: |
source .buildversions
git clone --depth 1 --branch ${WEBAPP_VERSION} https://github.com/polygloat/webapp.git
run: ./gradlew build

- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '12.x'

- name: Npm install
run: npm install
working-directory: ./webapp

- name: Build webapp
run: npm run build
working-directory: ./webapp

- run: WEBAPP_PATH=./webapp ./gradlew docker

- name: Start docker stack
run: docker run -d --name polygloat -e polygloat.internal.populate=true -e polygloat.internal.controller-enabled=true -p8080:8080 polygloat/polygloat

- name: Wait for running container
run: 'until docker logs --since 5m polygloat | grep -m 1 "started on port(s): 8080"; do : ;done'

- name: Run cypress tests
run: |
export CYPRESS_DEFAULT_PASSWORD=$(docker exec polygloat cat /data/initial.pwd)
npm run cy:run
working-directory: ./webapp
env:
CYPRESS_HOST: http://localhost:8080
CYPRESS_API_URL: http://localhost:8080/api/
- name: Run E2E test
run: ./gradlew runE2e

- uses: actions/upload-artifact@v2
if: always()
with:
name: cypress
name: test
path: |
./webapp/cypress/videos/**/*
./webappcypress/screenshots/**/*
./e2e/cypress/videos/**/*
./e2e/screenshots/**/*
./build/reports/**/*
17 changes: 13 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
build
polygloatRestructure.server.iml
polygloatRestructure.server.main.iml
polygloatRestructure.server.test.iml
*.iml
src/main/resources/application-dev.properties
src/main/resources/application-dev.yaml

bin
server.iml
trace.db
trace.db

webapp/node_modules/
webapp/lib
webapp/dist
webapp/tolgeeRestructure.webapp.iml
webapp/.env.dev
e2e/cypress/videos
e2e/cypress/screenshots
e2e/node_modules
e2e/cypress/integration/examples/
.gradle
34 changes: 10 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020. Polygloat
* Copyright (c) 2020. Tolgee
*/

buildscript {
Expand All @@ -24,7 +24,7 @@ plugins {
id "org.jetbrains.kotlin.kapt" version "1.4.21"
}

group = 'io.polygloat'
group = 'io.tolgee'

if (System.getenv().containsKey("VERSION")) {
project.version = System.getenv().get("VERSION")
Expand Down Expand Up @@ -52,7 +52,7 @@ repositories {

def liveDb = [
url : 'jdbc:postgresql://localhost:5432/postgres',
referenceUrl: 'hibernate:spring:io.polygloat' +
referenceUrl: 'hibernate:spring:io.tolgee' +
'?dialect=org.hibernate.dialect.PostgreSQL95Dialect' +
'&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy' +
'&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy',
Expand Down Expand Up @@ -126,7 +126,7 @@ dependencies {
kapt "org.hibernate:hibernate-jpamodelgen"
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.4.21'
liquibaseRuntime group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: '1.4.21'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.0'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.12.1'
implementation 'commons-codec:commons-codec:1.15'
compile group: 'com.amazonaws', name: 'aws-java-sdk-s3', version: '1.11.921'
compile group: 'com.ninja-squad', name: 'springmockk', version: '3.0.0'
Expand All @@ -145,7 +145,7 @@ springBoot {
}

bootJar {
archiveFileName = "polygloat-${project.version}.jar"
archiveFileName = "tolgee-${project.version}.jar"
manifest {
attributes('Implementation-Version': project.version)
}
Expand All @@ -156,8 +156,6 @@ sourceSets {
test.kotlin.srcDirs = ['src/test/kotlin', 'src/test/java']
}

def customWebApp = System.getenv().containsKey("WEBAPP_PATH")
def webappPath = customWebApp ? System.getenv().get("WEBAPP_PATH") : rootProject.project("webapp").projectDir
def unpackTarget = "build/dependency"

task unpack(type: Copy) {
Expand All @@ -166,31 +164,19 @@ task unpack(type: Copy) {
dependsOn "bootJar"
}

task copyDist(type: Copy) {
if (!customWebApp) {
evaluationDependsOn rootProject.project("webapp").getPath()
dependsOn rootProject.project("webapp").getTasks().findByName("build")
}
def fromDir = "${webappPath}/dist"
def toDir = "${project.projectDir}/build/dependency/BOOT-INF/classes/static/."
from fromDir
into toDir
inputs.dir(fromDir)
outputs.dir(toDir)
mustRunAfter unpack
}
apply from: "./gradle/webapp.gradle"
apply from: "./gradle/docker.gradle"
apply from: "./gradle/e2e.gradle"

project.tasks.findByName("dockerPrepare").mustRunAfter(copyDist)

apply from: "./docker.gradle"

task buildProd(dependsOn: ['bootJar'])

task packWebapp(type: Zip) {
dependsOn "unpack"
dependsOn "copyDist"
from "${project.projectDir}/build/dependency"
archiveFileName = "polygloat-${project.version}-test.jar"
archiveFileName = "tolgee-${project.version}-test.jar"
destinationDirectory = file("$buildDir/libs")
entryCompression ZipEntryCompression.STORED
}

2 changes: 1 addition & 1 deletion docker/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ COPY ${DEPENDENCY}/META-INF /app/META-INF
COPY ${DEPENDENCY}/BOOT-INF/classes /app
COPY ${DEPENDENCY}/${PROPERTIES} /app/application.yaml

ENTRYPOINT ["java","-cp","app:app/lib/*","io.polygloat.Application"]
ENTRYPOINT ["java","-cp","app:app/lib/*","io.tolgee.Application"]
4 changes: 2 additions & 2 deletions docker/app/application.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
polygloat:
tolgee:
file-storage:
fs-data-path: /data

spring:
datasource:
url: jdbc:h2:${polygloat.file-storage.fs-data-path}/db.h2
url: jdbc:h2:${tolgee.file-storage.fs-data-path}/db.h2
username: sa
password: password
liquibase:
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
# ports:
# - "5432:5432"
app:
image: polygloat/polygloat
image: tolgee/tolgee
ports:
- "8090:8080"
- "8091:8091"
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
environment:
- POSTGRES_PASSWORD=postgres
app:
image: polygloat/polygloat
image: tolgee/tolgee
ports:
- "8090:8080"
env_file:
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
environment:
- POSTGRES_PASSWORD=postgres
app:
image: polygloat/polygloat
image: tolgee/tolgee
ports:
- ${exposePort}:8080
env_file:
Expand Down
1 change: 1 addition & 0 deletions e2e/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading

0 comments on commit bbae391

Please sign in to comment.