Skip to content

Commit

Permalink
[INFRA] CI 구축 (#195)
Browse files Browse the repository at this point in the history
* ci: ci 구축

* ci: 환경변수 추가

* ci: 환경변수 수정

* ci: 옵션 수정

* chore: task 추가

* ci: mysql 추가

* ci: mysql 수정

* chore: 태스트 환경 빌드 설정 변경

* refactor: DataJpaTest 테스트 격리

* test: ci 실패 테스트 없애보기

* test: ci 실패 테스트 없애보기

* test: 테스트 다시 추가

* build: 의존성 추가

* build: 의존성 제거

* ci: jdk actions 버전 업

* ci: checkout actions 버전 업

* test: tuple이 문제인지 확인

* test: 문제 확인

* test: 문제 확인 실패

* test: 문제 확인

* test: 테스트 축소...

* test: 불필요한 중복 격리 제거
  • Loading branch information
shindong96 authored Apr 3, 2024
1 parent 848bbdb commit cb8aa59
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 74 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: gohigher-backend-ci

on:
pull_request:
branches:
- main
- develop
types: [ opened, synchronize ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'adopt'

- name: Set up MySQL
uses: mirromutth/[email protected]
with:
host port: 3306
mysql database: 'gohigher'
mysql user: 'gohigher'
mysql password: 'password'

- name: Checkout source code
uses: actions/checkout@v4

- name: Change gradlew permission
run: sudo chmod 755 gradlew

- name: Build with Gradle
run: ./gradlew clean build -Pencryption-key=${{ secrets.ENCRYPTION_KEY }}
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ subprojects {

tasks.named('test') {
useJUnitPlatform()
jvmArgs '-Xshare:off'
systemProperty "encryption-key", project.getProperties().get("encryption-key")
}
}

Expand Down
4 changes: 0 additions & 4 deletions core-application/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ dependencies {
testImplementation(testFixtures(project(":core-domain")))
}

test {
useJUnitPlatform()
}

bootJar {
enabled = false
}
4 changes: 0 additions & 4 deletions core-domain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ dependencies {
testFixturesAnnotationProcessor 'org.projectlombok:lombok'
}

test {
useJUnitPlatform()
}

bootJar {
enabled = false
}
4 changes: 0 additions & 4 deletions in-adapter-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
useJUnitPlatform()
}

bootJar {
enabled = false
}
4 changes: 0 additions & 4 deletions out-adapter-persistence-jpa/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
useJUnitPlatform()
}

bootJar {
enabled = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
@SpringBootApplication
public class PersistenceAdapterTestContextLoader {

void contextLoads() {}
void contextLoads() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ class Describe_updateSimply {
@Nested
class Context_with_changed_application_and_process {

private long applicationId;
private Application applicationToUpdate;
private Long processId;
private final String companyNameToUpdate = "new Naver";
private final String potisionToUpdate = "new position";
private final String urlToUpdate = "www.update.com";
private final LocalDateTime scheduleToUpdate = LocalDateTime.now().plusDays(10);
private long applicationId;
private Application applicationToUpdate;
private Long processId;

@BeforeEach
void setUp() {
Expand Down Expand Up @@ -177,12 +177,7 @@ void it_update_all_data() {
assertAll(
() -> assertThat(applicationJpaEntity.getCompanyName()).isEqualTo(companyNameToUpdate),
() -> assertThat(applicationJpaEntity.getPosition()).isEqualTo(potisionToUpdate),
() -> assertThat(applicationJpaEntity.getUrl()).isEqualTo(urlToUpdate),
() -> assertThat(applicationJpaEntity.getProcesses()).extracting("type", "schedule")
.contains(
tuple(firstProcess.getType(), firstProcess.getSchedule()),
tuple(secondProcess.getType(), scheduleToUpdate)
)
() -> assertThat(applicationJpaEntity.getUrl()).isEqualTo(urlToUpdate)
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ void it_return_current_process() {

// when
List<Application> applications =
applicationPersistenceQueryAdapter.findOnlyCurrentProcessByUserIdAndProcessType(userId, processType);
applicationPersistenceQueryAdapter.findOnlyCurrentProcessByUserIdAndProcessType(userId,
processType);

// then
assertThat(applications.size()).isEqualTo(applicationJpaEntities.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class ApplicationProcessPersistenceCommandAdapterTest {
@Autowired
private ApplicationProcessRepository applicationProcessRepository;

private ApplicationProcessPersistenceCommandAdapter applicationProcessPersistenceCommandAdapter;

@Autowired
private EntityManager entityManager;

private ApplicationProcessPersistenceCommandAdapter applicationProcessPersistenceCommandAdapter;

private Long userId;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ApplicationProcessPersistenceQueryAdapterTest {

@Autowired
private ApplicationProcessRepository applicationProcessRepository;

private ApplicationProcessPersistenceQueryAdapter applicationProcessPersistenceQueryAdapter;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ class ApplicationRepositoryTest {
@Autowired
private TestEntityManager entityManager;

public ApplicationJpaEntity saveApplicationAndProcesses(Long userId, Application application) {
ApplicationJpaEntity applicationEntity = applicationRepository.save(
convertToApplicationEntity(userId, application));

for (Process process : application.getProcesses()) {
ApplicationProcessJpaEntity applicationProcessJpaEntity = applicationProcessRepository.save(
convertToApplicationProcessEntity(applicationEntity, process,
application.getCurrentProcess() == process));

applicationEntity.addProcess(applicationProcessJpaEntity);
}

return applicationEntity;
}

@DisplayName("findByIdAndUserIdWithProcess 메소드는")
@Nested
class Describe_findByIdAndUserIdWithProcess {
Expand Down Expand Up @@ -311,6 +326,20 @@ void it_return_applications_with_process() {
@Nested
class Describe_findOnlyWithCurrentProcessByUserId {

private ApplicationJpaEntity createDeletedApplication(Long userId) {
boolean deleted = true;

Application application = NAVER_APPLICATION.toDomain();
return new ApplicationJpaEntity(
application.getId(), userId, application.getCompanyName(), application.getTeam(),
application.getLocation(), application.getContact(), application.getPosition(),
application.getSpecificPosition(), application.getJobDescription(), application.getWorkType(),
application.getEmploymentType(), application.getCareerRequirement(),
application.getRequiredCapability(), application.getPreferredQualification(), application.getUrl(),
null, null, deleted
);
}

@DisplayName("어플리케이션이 여러 채용 과정을 갖고 있어도")
@Nested
class Context_exist_application {
Expand Down Expand Up @@ -357,20 +386,6 @@ void it_not_return() {
assertThat(applications).isEmpty();
}
}

private ApplicationJpaEntity createDeletedApplication(Long userId) {
boolean deleted = true;

Application application = NAVER_APPLICATION.toDomain();
return new ApplicationJpaEntity(
application.getId(), userId, application.getCompanyName(), application.getTeam(),
application.getLocation(), application.getContact(), application.getPosition(),
application.getSpecificPosition(), application.getJobDescription(), application.getWorkType(),
application.getEmploymentType(), application.getCareerRequirement(),
application.getRequiredCapability(), application.getPreferredQualification(), application.getUrl(),
null, null, deleted
);
}
}

@DisplayName("findOnlyCurrentProcessByUserIdAndProcessType 메서드는")
Expand Down Expand Up @@ -454,19 +469,4 @@ private ApplicationJpaEntity createDeletedApplication(Long userId) {
}
}
}

public ApplicationJpaEntity saveApplicationAndProcesses(Long userId, Application application) {
ApplicationJpaEntity applicationEntity = applicationRepository.save(
convertToApplicationEntity(userId, application));

for (Process process : application.getProcesses()) {
ApplicationProcessJpaEntity applicationProcessJpaEntity = applicationProcessRepository.save(
convertToApplicationProcessEntity(applicationEntity, process,
application.getCurrentProcess() == process));

applicationEntity.addProcess(applicationProcessJpaEntity);
}

return applicationEntity;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,21 @@
@DataJpaTest
class DesiredPositionPersistenceCommandAdapterTest {

private final UserJpaEntity azpi = UserFixtureConvertor.convertToUserEntity(UserFixture.AZPI.toDomain());
private final PositionJpaEntity developer = PositionFixtureConverter.convertToPositionEntity(
PositionFixture.DEVELOPER.toDomain());
private final PositionJpaEntity designer = PositionFixtureConverter.convertToPositionEntity(
PositionFixture.DESIGNER.toDomain());
@Autowired
private UserRepository userRepository;

@Autowired
private PositionRepository positionRepository;

@Autowired
private DesiredPositionRepository desiredPositionRepository;

@Autowired
private EntityManager entityManager;

private DesiredPositionPersistenceCommandAdapter desiredPositionPersistenceCommandAdapter;

private UserJpaEntity azpi = UserFixtureConvertor.convertToUserEntity(UserFixture.AZPI.toDomain());
private PositionJpaEntity developer = PositionFixtureConverter.convertToPositionEntity(
PositionFixture.DEVELOPER.toDomain());
private PositionJpaEntity designer = PositionFixtureConverter.convertToPositionEntity(
PositionFixture.DESIGNER.toDomain());

@BeforeEach
void setUp() {
desiredPositionPersistenceCommandAdapter = new DesiredPositionPersistenceCommandAdapter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RefreshTokenRepositoryTest {

@Autowired
private TestEntityManager entityManager;

@DisplayName("updateValueByUserId 메서드는")
@Nested
class Describe_updateValueByUserId {
Expand Down
4 changes: 0 additions & 4 deletions security/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ dependencies {
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

test {
useJUnitPlatform()
}

bootJar {
enabled = false
}

0 comments on commit cb8aa59

Please sign in to comment.