-
Notifications
You must be signed in to change notification settings - Fork 7
140 lines (118 loc) · 4.47 KB
/
tests.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Standard Tests
on: [push, pull_request, workflow_dispatch] #workflow_dispatch works only if its active in the main branch
jobs:
Unit-Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setting up JDK 12
uses: actions/setup-java@v2
with:
java-version: '12'
distribution: 'adopt' #using a specific distribution of jdk12 (AdoptOpenJDK)
- name: Setting up Gradle
uses: gradle/gradle-build-action@v2
- name: Setting up Gradle Wrapper
run: "gradle wrapper"
- name: Validating Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setting up the SQLite database and Make
run: |
sqlite3 -version
make -version
make clean-all
make sqlite-db-build
make sqlite-db-populate-dev-dataset
- name: Running Tests
run: "./gradlew test --tests=org.*"
- name: After Success Submitting Code Coverage
run: | #jacocoTestReport is for testing code coverage, submits the last report to the link
./gradlew jacocoTestReport
bash <(curl -s https://codecov.io/bash)
Docker-Integration-Test:
needs: Unit-Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setting up Gradle
uses: gradle/gradle-build-action@v2
- name: Setting Up Docker Buildx #used for caching image layers, improves performance
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get and Set Version
run: |
source ci/set-docker-image-version.sh
echo "version=${DOCKER_IMG_VER}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: ./Dockerfile
push: true
tags: ga4gh/ga4gh-starter-kit-drs:test
build-args: VERSION=${{ env.version }}
cache-from: type=gha #GitHub Actions Cache Exporter
cache-to: type=gha,mode=max
- name: Running Tests
run: |
docker run --rm -d --name starter-kit-drs-test-default -p 4500:4500 -p 4501:4501 ga4gh/ga4gh-starter-kit-drs:test
docker run --rm -d --name starter-kit-drs-test-custom -p 7000:7000 -p 7001:7001 ga4gh/ga4gh-starter-kit-drs:test --config ./src/test/resources/config/test-config-01.yml
- name: Gradle Integration Test
run: ./gradlew test --tests=integration.*
Docker-Release:
needs: Docker-Integration-Test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push' #Only runs if pushing to main
steps:
- uses: actions/checkout@v2
- name: Setting Up Docker Buildx #used for caching image layers, improves performance
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Get and Set Version
run: |
source ci/set-docker-image-version.sh
echo "version=${DOCKER_IMG_VER}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
file: ./Dockerfile
push: true
tags: ga4gh/ga4gh-starter-kit-drs:${{ env.version }} #Using the correct version as the tag
build-args: VERSION=${{ env.version }}
cache-from: type=gha #GitHub Actions Cache Exporter
cache-to: type=gha,mode=max
build:
name: Create GitHub Release
needs: Docker-Integration-Test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push' #Only runs if pushing to main
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Get and Set Version
run: |
source ci/set-docker-image-version.sh
echo "version=${DOCKER_IMG_VER}" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.version }} #will be v0.2.2 for example
release_name: GA4GH Starter Kit - DRS v${{ env.version }}
draft: false
prerelease: true