Skip to content

Commit

Permalink
Switched over to using GithubActions for CI services and re-implement…
Browse files Browse the repository at this point in the history
…ed our existing tests as github an actions workflow. Also removed the old Travis Infrastructure
  • Loading branch information
lbergelson authored and jamesemery committed Apr 8, 2022
1 parent 8bce5ed commit 1b7f987
Show file tree
Hide file tree
Showing 35 changed files with 666 additions and 498 deletions.
19 changes: 19 additions & 0 deletions .github/actions/install-cromwell/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'install-cromwell'
description: 'installs cromwell and womtool locally for jobs that require it'
inputs:
CROMWELL_VERSION: # id of input
description: 'Cromwell Version to download'
required: true
runs:
using: "composite"
steps:
- name: Set Cromwell env variables
run: |
echo "CROMWELL_JAR=${HOME}/cromwell-${{ inputs.CROMWELL_VERSION }}.jar" >> $GITHUB_ENV;
echo "WOMTOOL_JAR=${HOME}/womtool-${{ inputs.CROMWELL_VERSION }}.jar" >> $GITHUB_ENV;
shell: bash
- name: Download Cromwell and Womtools
run: |
wget -O $CROMWELL_JAR https://github.com/broadinstitute/cromwell/releases/download/${{ inputs.CROMWELL_VERSION }}/cromwell-${{ inputs.CROMWELL_VERSION }}.jar;
wget -O $WOMTOOL_JAR https://github.com/broadinstitute/cromwell/releases/download/${{ inputs.CROMWELL_VERSION }}/womtool-${{ inputs.CROMWELL_VERSION }}.jar;
shell: bash
89 changes: 89 additions & 0 deletions .github/actions/upload-results/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: 'upload-results'
description: 'uploads our codeCov and jococo test results'
inputs:
warnPR:
description: 'Update the failure logs on the PR for this job'
required: true
default: 'false'
repo-token:
description: 'The GITHUB_TOKEN secret'
required: false
test-type:
description: 'Type to lable this test as'
required: true
jdk-version:
description: 'jdk used for this test'
required: true
job-matrix-id:
description: 'The job-unique identifier for which test was run'
required: true
repo-path:
description: 'The job-unique identifier to use for uploading the results of this run into a google bucket'
required: true
identifier:
description: 'Identifier to use for finding the unique name for jobs in order to determine html logs location'
required: true
bot-comment-key:
description: 'Key to be used for commenting failed jobs on github PRs'
required: false

runs:
using: "composite"
steps:
- name: Upload to codecov
run: bash <(curl -s https://raw.githubusercontent.com/broadinstitute/codecov-bash-uploader/main/codecov-verified.bash)
shell: bash
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results-${{ matrix.Java }}-${{ matrix.testType }}
path: build/reports/tests

- name: Upload Reports
id: uploadreports
run: |
gsutil -m cp -z html -z js -z xml -z css -r build/reports/tests gs:/${{ env.HELLBENDER_TEST_LOGS }}${{ inputs.repo-path }}/;
VIEW_URL=https://storage.googleapis.com${{ env.HELLBENDER_TEST_LOGS }}${{ inputs.repo-path }}/tests/test/index.html
echo "See the test report at ${VIEW_URL}";
echo ::set-output name=view_url::"${VIEW_URL}"
shell: bash

# This code is necessary in order to extract the URL for the logs for a particular run. The github context exposes the run_id object
# which corresponds to the unique identifier for an individual workflow execution but it doesn't expose the job_id.id which is necessary
# to extract the logs for failing jobs. The best workaround seems to be this approach (querying the API and parsing the json output).
- name: Extract Log Location
id: loghtml
env:
GITHUB_TOKEN: ${{ inputs.repo-token }}
run: |
GITHUB_BASEURL=https://api.github.com
REPO_ID=$(curl --get -Ss -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{ github.repository }} | jq -r .id)
GITHUB_API="/repositories/${REPO_ID}/actions/runs/${{ github.run_id }}/jobs"
echo "${{ inputs.identifier }}"
#curl --get -Ss -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" "${GITHUB_BASEURL}${GITHUB_API}?per_page=${INPUT_PER_PAGE:-H30}"
eval "$(curl --get -Ss -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" "${GITHUB_BASEURL}${GITHUB_API}?per_page=${INPUT_PER_PAGE:-H30}" \
| jq -r --arg job_name "${{ inputs.identifier }}" '.jobs | map(select(.name == $job_name)) | .[0] | @sh "job_id=\(.id) html_url=\(.html_url)"')"
echo ::set-output name=job_id::"${job_id}"
echo ::set-output name=html_url::"${html_url}"
echo ${job_id}
echo ${html_url}
shell: bash

- name: Updating the PR with failed results
if: ${{ inputs.warnPR == 'true' }}
env:
GITHUB_TOKEN: ${{ inputs.bot-comment-key }}
TEST_TYPE: ${{ inputs.test-type }}
GITHUB_EVENT_NUMBER: ${{ github.event.number }}
GITHUB_REPOSITORY: ${{ github.repository }}
JOB_MATRIX_ID: ${{ inputs.job-matrix-id }}
GITHUB_RUN_ID: ${{ github.run_id }}
JDK_VERSION: ${{ inputs.jdk-version }}
ACTIONS_JOB_WEB_URL: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
GITHUB_LOGS_URL: ${{ steps.loghtml.outputs.html_url }}
run: |
pip install --user PyGithub;
python scripts/github_actions/Reporter.py ${{ steps.uploadreports.outputs.view_url }};
shell: bash
Loading

0 comments on commit 1b7f987

Please sign in to comment.