Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PF-2033, PF-2989: Trigger Unit Tests On PR Commits #116

Merged
merged 6 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build and Test

on:
push:
branches: [ develop ]
paths-ignore: [ '*.md' ]
pull_request:
branches: [ '**' ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Build with Gradle
# TODO: Spotbugs references can be removed once
# https://github.com/DataBiosphere/stairway/pull/115 is merged
run: ./gradlew build -x test -x spotBugsMain -x spotBugsTest
unit-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13
env:
# Default values stairway expects based on DEVELOPMENT.md
POSTGRES_PASSWORD: stairwaypw
POSTGRES_USER: stairwayuser
POSTGRES_DB: stairwaylib
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports: [ "5432:5432" ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Run tests
run: ./gradlew test

# TODO: Work with AppSec to get Sonar scans setup for this repo
# Run the Sonar scan after `gradle test` to include code coverage data in its report.
# - name: Sonar scan
# run: ./gradlew --build-cache sonar
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# TODO: Once Terraform PR is setup, uncomment the following block
# to enable workflow reporting to slack
# report workflow status in slack
# see https://docs.google.com/document/d/1G6-whnNJvON6Qq1b3VvRJFC7M9M-gu2dAVrQHDyp9Us/edit?usp=sharing
# report-workflow:
# uses: broadinstitute/sherlock/.github/workflows/client-report-workflow.yaml@main
# with:
# Channels to notify upon workflow success or failure
# notify-slack-channels-upon-workflow-completion: '#platform-foundation'

# Channels to notify upon workflow success only
# notify-slack-channels-upon-workflow-success: "#channel-here"

# Channels to notify upon workflow failure only
# notify-slack-channels-upon-workflow-failure: "#channel-here"
# permissions:
# id-token: 'write'
2 changes: 2 additions & 0 deletions stairway/src/test/java/bio/terra/stairway/SleepQueueTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Disabled;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Tag("unit")
public class SleepQueueTest {
private final Logger logger = LoggerFactory.getLogger(SleepQueueTest.class);

@Disabled("This test is flaky and consistently fails when running on a fresh environment for the first time")
@Test
public void clusterSuccessTest() throws Exception {
QueueInterface workQueue = FileQueue.makeFileQueue("clusterSuccessTest");
Expand Down
Loading