-
Notifications
You must be signed in to change notification settings - Fork 2
48 lines (44 loc) · 1.38 KB
/
test_action.yml
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
48
name: Test CI
on:
push:
branches: [ main, develop ]
pull_request:
types: [ opened, ready_for_review, synchronize, reopened ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Create environment variable file from ENV_LIST secret
run: |
echo "${{ secrets.TEST_ENV }}" > .env
echo "Environment variable file (.env) created:"
- name: Load environment variables from .env file
run: |
if [ -f .env ]; then
while IFS= read -r line; do
if [[ $line != \#* ]] && [[ $line == *"="* ]]; then
echo "$line" >> $GITHUB_ENV
fi
done < .env
echo "Environment variables loaded from .env"
else
echo ".env file not found!"
fi
- name: Build and test with Gradle
run: ./gradlew build
- name: Run tests
run: ./gradlew test