Update README.md #230
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
with: | |
gradle-version: 7.3.2 | |
- 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 | |
with: | |
gradle-version: 7.3.2 | |
- 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 |