diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..933de3a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: build + +on: + workflow_call: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Set up MySQL + uses: mirromutth/mysql-action@v1.1 + with: + host port: 3306 + container port: 3306 + character set server: 'utf8mb4' + collation server: 'utf8mb4_general_ci' + mysql version: '9.0' + mysql database: 'accompany' + mysql user: 'root' + mysql password: '1234' + + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Build with Gradle Wrapper + run: ./gradlew build -s diff --git a/.github/workflows/dependency-submission.yml b/.github/workflows/dependency-submission.yml new file mode 100644 index 0000000..de7375d --- /dev/null +++ b/.github/workflows/dependency-submission.yml @@ -0,0 +1,22 @@ +name: dependency-submission + +on: + workflow_call: + +jobs: + dependency-submission: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Generate and submit dependency graph + uses: gradle/actions/dependency-submission@v3 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..3cc76b2 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,27 @@ +name: Java CI/CD + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + JWT_ISSUER: dnd-11-1 + JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }} + +jobs: + build: + permissions: + contents: read + uses: ./.github/workflows/build.yml + + test: + permissions: + contents: read + uses: ./.github/workflows/test.yml + + dependency-submission: + permissions: + contents: write + uses: ./.github/workflows/dependency-submission.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..703ef43 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +name: test + +on: + workflow_call: + +jobs: + test: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - uses: actions/checkout@v4 + + - name: Set up MySQL + uses: mirromutth/mysql-action@v1.1 + with: + host port: 3306 + container port: 3306 + character set server: 'utf8mb4' + collation server: 'utf8mb4_general_ci' + mysql version: '9.0' + mysql database: 'accompany' + mysql user: 'root' + mysql password: '1234' + + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: test with Gradle Wrapper + run: ./gradlew test -s