@@ -3,73 +3,39 @@ name: Build Lambda
33on :
44 push :
55 branches :
6- - ' **'
6+ - ' master'
7+ pull_request :
78
89jobs :
9- check-runner :
10- name : Check Runner Availability
11- runs-on : ubuntu-latest
12-
13- outputs :
14- runner-label : ${{ steps.set-runner.outputs.runner-label }}
15-
16- steps :
17- - name : Set runner
18- id : set-runner
19- run : |
20- runners=$(curl -v -s -H "Accept: application/vnd.github+json" -H "Authorization: token ${{ secrets.REPO_ACCESS_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/runners" --http1.1)
21- if [ $? -ne 0 ]; then
22- echo "Error: Failed to fetch runners from GitHub API" >&2
23- exit 1
24- fi
25-
26- runners_count=$(echo "$runners" | jq '.runners | length')
27- if [ "$runners_count" -eq 0 ]; then
28- echo "No runners available or failed to retrieve runners." >&2
29- echo "runner-label=ubuntu-latest" >> $GITHUB_OUTPUT
30- exit 0
31- fi
32-
33- available=$(echo "$runners" | jq '.runners[] | select(.status == "online" and .busy == false and .labels[] .name == "self-hosted")')
34- if [ $? -ne 0 ]; then
35- echo "Error : Failed to parse JSON response" >&2
36- exit 1
37- fi
38-
39- if [ -n "$available" ]; then
40- echo "runner-label=lambda-linux-runner" >> $GITHUB_OUTPUT
41- else
42- echo "runner-label=ubuntu-latest" >> $GITHUB_OUTPUT
43- fi
4410 build :
4511 concurrency :
4612 group : ${{ github.workflow }}-${{ github.ref }}
4713 cancel-in-progress : true
48-
49- needs : check-runner
50- runs-on : ${{ needs.check-runner.outputs.runner-label }}
5114
52- name : Build Lambda
15+ name : Build and test Lambda
16+ runs-on : ubuntu-latest
17+
5318 permissions :
5419 contents : write
20+
5521 env :
5622 SEGMENT_DOWNLOAD_TIMEOUT_MINS : ' 5'
5723 steps :
58- - name : Checkout Repository
59- uses : actions/checkout@v4.1.1
60-
6124 - name : Set current date as env variable
6225 run : echo "DATE=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV
6326
6427 - name : Get Short Commit Hash
6528 id : vars
6629 run : echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
6730
68- - name : Set-Up JDK 17
31+ - name : Checkout Repository
32+ uses : actions/checkout@v4
33+
34+ - name : Set-Up JDK
6935 uses : actions/setup-java@v4
7036 with :
7137 distribution : ' temurin'
72- java-version : ' 17 '
38+ java-version : ' 23 '
7339 architecture : x64
7440 cache : ' gradle'
7541
8147 all : true
8248
8349 - name : Build Lambda
84- run : ./gradlew build
50+ run : ./gradlew build --no-daemon
51+
52+ - name : Test Lambda
53+ run : ./gradlew common:test --no-daemon
8554
8655 - name : Rename Files with Commit Hash
8756 run : |
0 commit comments