-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (40 loc) · 1.57 KB
/
Copy pathmain.yml
File metadata and controls
48 lines (40 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Name of the workflow (appears in GitHub Actions tab)
name: Backend CI
on:
# Run workflow when pushing to main branch
push:
branches: [ "main" ]
# Run workflow when opening/updating a pull request targeting main
pull_request:
branches: [ "main" ]
jobs:
build:
# GitHub provides virtual machines (runners)
# 'ubuntu-latest' is free, fast, and has Java/Maven preinstalled
runs-on: ubuntu-latest
steps:
# Step 1: Get your repository code into the runner
- name: Checkout repository
uses: actions/checkout@v4
# Step 2: Install Java (JDK 8 in your case)
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: '8' # Java version required for your project
distribution: 'temurin' # Open-source JDK distribution
# Step 3: Define environment variable for test environment
# $GITHUB_ENV is a special file to persist env vars between steps
- name: Set environment to test
run: echo "ENVIRONMENT=test" >> $GITHUB_ENV
# Step 4: Build the project and run JUnit tests using Maven
# -B means batch mode (non-interactive, cleaner CI logs)
# 'clean' removes old builds, 'verify' compiles and runs tests
# to only build the backend
- name: Build and run tests with Maven
run: mvn -B clean verify
working-directory: backend
# Step 5: Install Render CLI
- name: Install Render CLI
run: curl https://cli.render.com/install.sh | sh
env:
RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }}