Skip to content

Commit df1d940

Browse files
authored
Create Github Action (#265)
* Create Github Action * Remove travis integration * Remove travis spring boot profile
1 parent df9a897 commit df1d940

File tree

4 files changed

+56
-46
lines changed

4 files changed

+56
-46
lines changed

.github/workflows/main.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Test and build
2+
3+
on:
4+
push:
5+
branches: [master, develop]
6+
pull_request:
7+
branches: [master, develop]
8+
9+
jobs:
10+
build_and_test:
11+
name: Build and test
12+
runs-on: ubuntu-latest
13+
permissions:
14+
security-events: write
15+
env:
16+
SPRING_PROFILES_ACTIVE: githubaction
17+
DB_DATABASE: test
18+
DB_USER: root
19+
DB_PASSWORD: root
20+
GRADLE_OPTS: "-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError -XX:-UseGCOverheadLimit"
21+
steps:
22+
- name: Mysql Setup
23+
run : |
24+
sudo systemctl start mysql.service
25+
mysql -e 'DROP DATABASE IF EXISTS ${{ env.DB_DATABASE }}; CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }}
26+
- name: Checkout code
27+
uses: actions/checkout@v3
28+
- name: Setup Java
29+
uses: actions/setup-java@v3
30+
with:
31+
distribution: 'temurin'
32+
java-version: '8'
33+
- name: Run Gradle
34+
run: ./gradlew test
35+
build_and_push_docker_to_registry:
36+
name: Push Docker image to Registry
37+
runs-on: ubuntu-latest
38+
needs: [build_and_test]
39+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
40+
steps:
41+
- name: Check out the repo
42+
uses: actions/checkout@v2
43+
- name: Set branch name
44+
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
45+
- name: Login to DockerHub
46+
uses: docker/login-action@v1
47+
with:
48+
registry: ${{ secrets.DOCKER_REGISTRY }}
49+
username: breakout
50+
password: ${{ secrets.DOCKER_PASSWORD }}
51+
- name: Build and push
52+
uses: docker/build-push-action@v2
53+
with:
54+
push: true
55+
tags: ${{ secrets.DOCKER_REGISTRY }}/breakout-backend:${{ env.BRANCH }}

.travis.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

secrets.zip.enc

-1.92 KB
Binary file not shown.

src/main/resources/application-travis.properties renamed to src/main/resources/application-githubaction.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
33
spring.datasource.url=jdbc:mysql://127.0.0.1/test
44
spring.datasource.username=root
5-
spring.datasource.password=
5+
spring.datasource.password=root
66
spring.datasource.hikari.pool-name=BreakOutBackendHikariCP
77
spring.datasource.hikari.maximum-pool-size=15
88
spring.datasource.hikari.minimum-idle=3

0 commit comments

Comments
 (0)