Skip to content

Commit

Permalink
setup github action
Browse files Browse the repository at this point in the history
  • Loading branch information
gy2006 committed Dec 14, 2024
1 parent c5116df commit 8b40422
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: flow.ci

on:
push:
branches:
- feature/**

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git Clone
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
cache: maven

- name: Build with Maven
run: ./mvnw test
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/flowci/common/model/EntityListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@
import jakarta.persistence.PreUpdate;

import java.time.Instant;
import java.time.temporal.ChronoUnit;

public class EntityListener {

@PrePersist
public void prePersist(Object entity) {
if (entity instanceof EntityBase e) {
e.createdAt = Instant.now();
e.updatedAt = Instant.now();
e.createdAt = Instant.now().truncatedTo(ChronoUnit.MICROS);
e.updatedAt = Instant.now().truncatedTo(ChronoUnit.MICROS);
}
}

@PreUpdate
public void preUpdate(Object entity) {
if (entity instanceof EntityBase e) {
e.updatedAt = Instant.now();
e.updatedAt = Instant.now().truncatedTo(ChronoUnit.MICROS);
}
}
}

0 comments on commit 8b40422

Please sign in to comment.