Skip to content

Commit

Permalink
Kotlin inception (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavetok authored Nov 12, 2023
1 parent eaf962f commit f11c075
Show file tree
Hide file tree
Showing 63 changed files with 714 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .dx/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
shannon:: Клод Шеннон
lamport:: Лесли Лампорт
milner:: Робин Мильнер
nakamoto:: Сатоши Накомото

== Разработка (devenv)

Expand All @@ -20,4 +21,3 @@ girard:: Рене Жирар
martin-lof:: Пер Мартин-Лёф
honda:: Кохэй Хонда
voevodsky:: Владимир Воеводский
nakamoto:: Сатоши Накомото
15 changes: 8 additions & 7 deletions .dx/binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
hosts: app
run_once: true
tasks:
- name: Capture env
ansible.builtin.include_vars:
file: ../envs/dev/{{ devenv }}/vars.yaml
name: dev
tags: [always]
- name: Capture cid's
ansible.builtin.command:
cmd: git hash-object --stdin
Expand All @@ -14,7 +19,7 @@
# TODO: try to choose better name
register: image_cid
changed_when: false
loop: "{{ app_images.keys() }}"
loop: "{{ app_cids.keys() if dev.java_release < 21 else app_cids.keys()| difference('sepuling-kotlin') }}"
loop_control:
loop_var: app
tags: [always]
Expand All @@ -24,7 +29,7 @@
tags: [always]
- name: Capture statuses
ansible.builtin.command:
cmd: docker {{ docker_entity }} inspect {{ app_images[app] }}:{{ image_cids[app][:7] }}-{{ opsenv }}
cmd: docker {{ docker_entity }} inspect {{ app_images[app] }}:{{ image_cids[app][:7] }}-{{ devenv }}
register: image_status
changed_when: image_status.rc != 0
failed_when: false
Expand All @@ -37,10 +42,6 @@
msg: "{{ image_status.results|map(attribute='cmd')|map('join', ' ') }}"
when: image_status is changed
tags: [always]
- name: Capture env
ansible.builtin.include_vars:
file: ../envs/ops/{{ opsenv }}.yaml
name: ops
- name: Create binaries
ansible.builtin.command:
cmd: >
Expand All @@ -63,7 +64,7 @@
{% else %}
package
{% endif %}
--define maven.compiler.release={{ ops.java_release }}
--define maven.compiler.release={{ dev.java_release }}
chdir: "{{ playbook_dir }}/.."
strip_empty_ends: false
changed_when: true
Expand Down
6 changes: 5 additions & 1 deletion .dx/codebase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
--no-snapshot-updates
--batch-mode
{% if focus == 'solution' %}
--projects apps/sepuling
--projects {{
app_cids.keys()
| map('regex_replace', '^', 'apps/')
| join(',')
}}
{% elif focus == 'toolchain' %}
--projects tests/e2e
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions .dx/images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@
when: image_status is changed
- name: Capture env
ansible.builtin.include_vars:
file: ../envs/ops/{{ opsenv }}.yaml
name: ops
file: ../envs/dev/{{ devenv }}/vars.yaml
name: dev
- name: Create images
ansible.builtin.include_role:
name: image
vars:
image_tag: "{{ image_cids[app][:7] }}-{{ opsenv }}"
image_tag: "{{ image_cids[app][:7] }}-{{ devenv }}"
image_name: "{{ app_images[app] }}"
image_home: "{{ playbook_dir }}/../apps/{{ app }}"
image_context: target/docker-context
image_push: "{{ focus == 'solution' }}"
image_args:
JAVA_RELEASE: "{{ ops.java_release }}"
JAVA_RELEASE: "{{ dev.java_release }}"
loop: "{{ image_status.results|select('changed')|map(attribute='app') }}"
loop_control:
loop_var: app
Expand Down
13 changes: 10 additions & 3 deletions .dx/inventory/group_vars/all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ usecase: toy
lib_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs')[:7] }}"
lib_cids:
abstraction: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/abstraction')[:7] }}"
abstraction-client: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/abstraction-client')[:7] }}"
essentials: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/essentials')[:7] }}"
messaging: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/messaging')[:7] }}"
messaging-client: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/messaging-client')[:7] }}"
storage: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/storage')[:7] }}"
testing: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=libs/testing')[:7] }}"
app_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=apps')[:7] }}"
app_cids:
sepuling: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=apps/sepuling')[:7] }}"
sepuling-java: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=apps/sepuling-java')[:7] }}"
sepuling-kotlin: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=apps/sepuling-kotlin')[:7] }}"
schema_cid: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=schemas')[:7] }}"
schema_cids:
postgres: "{{ lookup('ansible.builtin.pipe', 'git write-tree --prefix=schemas/postgres')[:7] }}"
Expand All @@ -37,7 +40,8 @@ binary_repo: local
image_repo: local

app_images:
sepuling: "{{ image_repo }}/{{ organization }}/{{ project }}/app/sepuling"
sepuling-java: "{{ image_repo }}/{{ organization }}/{{ project }}/app/sepuling-java"
sepuling-kotlin: "{{ image_repo }}/{{ organization }}/{{ project }}/app/sepuling-kotlin"
schema_images:
postgres: "{{ image_repo }}/{{ organization }}/{{ project }}/schema/postgres"
stack_images:
Expand All @@ -46,5 +50,8 @@ stack_images:

docker_entity: "{{ 'image' if image_repo == 'local' else 'manifest' }}"

sepuling_deps: [abstraction, abstraction-client, essentials, messaging, messaging-client, storage]

app_deps:
sepuling: [abstraction, essentials, messaging, storage]
sepuling-java: "{{ sepuling_deps }}"
sepuling-kotlin: "{{ sepuling_deps }}"
4 changes: 2 additions & 2 deletions .dx/tasks/solution/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
POSTGRES_VERSION: "{{ ops.postgres_version }}"
SCHEMA_TAG: "{{ schema_cids.postgres }}"
SCHEMA_IMAGE: "{{ schema_images.postgres }}"
SEPULING_TAG: "{{ hostvars.app.image_cids.sepuling[:7] }}-{{ opsenv }}"
SEPULING_IMAGE: "{{ app_images.sepuling }}"
SEPULING_TAG: "{{ hostvars.app.image_cids['sepuling-' ~ ops.sepuling.lang_mode][:7] }}-{{ devenv }}"
SEPULING_IMAGE: "{{ app_images['sepuling-' ~ ops.sepuling.lang_mode] }}"
CONFIG_FILE_NAME: "{{ ops.config_file_name.target }}"
CONFIG_MAPPING_MODE: "{{ ops.config_mapping_mode }}"
changed_when: true
6 changes: 6 additions & 0 deletions .dx/tasks/solution/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
strip_empty_ends: false
changed_when: true

- name: Capture env
ansible.builtin.include_vars:
file: ../envs/dev/{{ devenv }}/vars.yaml
name: dev

- name: Test stand
ansible.builtin.command:
cmd: >
Expand All @@ -39,6 +44,7 @@
{% if modulus is defined %}
--define bezmen.sharding.modulus={{ modulus }}
{% endif %}
--define maven.compiler.release={{ dev.java_release }}
--define skipUnits=true
chdir: "{{ playbook_dir }}/.."
strip_empty_ends: false
Expand Down
9 changes: 8 additions & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,19 @@ updates:
spring-framework:
patterns:
- "org.springframework*"
junit-platform:
patterns:
- "org.junit*"
- package-ecosystem: "docker"
directory: "/schemas/postgres"
schedule:
interval: "weekly"
- package-ecosystem: "docker"
directory: "/apps/sepuling"
directory: "/apps/sepuling-java"
schedule:
interval: "weekly"
- package-ecosystem: "docker"
directory: "/apps/sepuling-kotlin"
schedule:
interval: "weekly"
- package-ecosystem: "pip"
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/solution-beyond-doubt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
- ops: lamport
dev: turing
- ops: milner
dev: turing
- ops: nakamoto
dev: church
steps:
- uses: actions/[email protected]
Expand Down Expand Up @@ -76,7 +78,7 @@ jobs:
strategy:
fail-fast: false
matrix:
opsenv: [shannon, lamport, milner]
opsenv: [shannon, lamport, milner, nakamoto]
usecase: [func]
runs-on: ubuntu-22.04
steps:
Expand Down Expand Up @@ -104,7 +106,7 @@ jobs:
strategy:
fail-fast: false
matrix:
opsenv: [shannon, lamport, milner]
opsenv: [shannon, lamport, milner, nakamoto]
usecase: [func]
shard: [0, 1]
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -144,7 +146,7 @@ jobs:
strategy:
fail-fast: false
matrix:
opsenv: [shannon, lamport, milner]
opsenv: [shannon, lamport, milner, nakamoto]
usecase: [func]
runs-on: ubuntu-22.04
permissions:
Expand Down
61 changes: 59 additions & 2 deletions apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@
<version>${revision}</version>

<modules>
<module>sepuling</module>
<module>sepuling-java</module>
<module>sepuling-kotlin</module>
</modules>

<properties>
<revision>0.1.0-SNAPSHOT</revision>
<lombok.version>1.18.30</lombok.version>
<mapstruct.version>1.5.5.Final</mapstruct.version>
<kotlin.version>1.9.20</kotlin.version>
<skipTests>false</skipTests>
<skipUnits>${skipTests}</skipUnits>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.release>19</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down Expand Up @@ -81,6 +83,37 @@
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<configuration>
<jvmTarget>${maven.compiler.release}</jvmTarget>
</configuration>
<executions>
<execution>
<id>kapt</id>
<goals>
<goal>kapt</goal>
</goals>
<configuration>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</annotationProcessorPath>
</annotationProcessorPaths>
</configuration>
</execution>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -99,6 +132,30 @@
</path>
</annotationProcessorPaths>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
<execution>
<id>default-testCompile</id>
<phase>none</phase>
</execution>
<execution>
<id>java-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>java-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion apps/sepuling/pom.xml → apps/sepuling-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<version>${revision}</version>
</parent>

<artifactId>sepuling</artifactId>
<artifactId>sepuling-java</artifactId>

<dependencies>
<dependency>
Expand Down
12 changes: 12 additions & 0 deletions apps/sepuling-kotlin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
ARG JAVA_RELEASE
FROM eclipse-temurin:${JAVA_RELEASE}-jre-alpine
RUN addgroup -S bezmen && adduser -S bezmen -G bezmen
USER bezmen:bezmen
WORKDIR /home/bezmen
COPY libs libs
COPY sepuling*.jar app.jar
ENTRYPOINT [ \
"java", "-cp", "app.jar:libs/*", \
"-Dconfig.file=application.conf", \
"smecalculus.bezmen.construction.AppKt" \
]
Loading

0 comments on commit f11c075

Please sign in to comment.