Skip to content

Commit

Permalink
Merge pull request #74 from ES2-UFPI/72-implementar-integração-continua
Browse files Browse the repository at this point in the history
Add workflow to use CI
  • Loading branch information
AveiaPodre authored Jan 7, 2025
2 parents 7307416 + 254d915 commit ab736fd
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 2 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/


steps:
- uses: actions/checkout@v4

- name: Set up Docker Compose
run: sudo apt-get install docker-compose

- name: Start database with Docker Compose
run: docker compose up -d

- name: Wait for database to be ready
run: |
while ! nc -z localhost 5432; do
echo "Waiting for database..."
sleep 2
done
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
cache: maven
- name: Build with Maven
working-directory: ./backend
run: mvn -B package --file pom.xml

- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: ./frontend/package-lock.json

- name: Install dependencies
working-directory: ./frontend
run: npm ci

- name: Build project
working-directory: ./frontend
run: npm run build --if-present

- name: Run tests
working-directory: ./frontend
run: npm test
2 changes: 1 addition & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ services:
- 'POSTGRES_PASSWORD=remedius123'
- 'POSTGRES_USER=remedius'
ports:
- '5433:5432'
- '5432:5432'
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"ios": "expo start --ios",
"web": "expo start --web",
"lint": "expo lint",
"test": "jest",
"test": "jest --config jest.config.js",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage"
},
Expand Down

0 comments on commit ab736fd

Please sign in to comment.