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

👷 Change build and run analysis conditions #445

Merged
merged 1 commit into from
Oct 10, 2023
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
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build

on:
push:
branches:
- 'dev'
paths:
- 'Dockerfile'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition will only trigger if a commit is merged into the dev branch AND that commit has a change to the Dockerfile.


jobs:
build_and_publish_image:
name: Build and Publish Image
runs-on: ubuntu-latest-m
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the large runner to build since it will be more infrequent per the condition above.

steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: pgc-images.sbgenomics.com/d3b-bixu/open-pedcan
tags: |
type=raw,value=latest

- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: pgc-images.sbgenomics.com
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: github_pat=${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,55 +1,12 @@
name: CI
name: Analysis

on:
push:
branches:
- dev
pull_request:
workflow_dispatch:
Comment on lines 4 to 5
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the analysis workflow now. It will trigger due to either of the below conditions:

  • A new PR is opened
  • A manual workflow is triggered through the GitHub Actions console


jobs:
build_and_publish_image:
name: Build and Publish Image
runs-on: ubuntu-latest-m
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: pgc-images.sbgenomics.com/d3b-bixu/open-pedcan
tags: |
type=raw,value=analysisjob
# Only tag the image with latest if we're building on the default
# branch (e.g., dev).
type=raw,value=latest,enable={{is_default_branch}}

- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: pgc-images.sbgenomics.com
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: github_pat=${{ secrets.GITHUB_TOKEN }}

run_analysis:
name: Run Analysis
needs: build_and_publish_image
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -166,19 +123,19 @@ jobs:
- uses: actions/checkout@v3

- name: Download Data
uses: docker://pgc-images.sbgenomics.com/d3b-bixu/open-pedcan:analysisjob
uses: docker://pgc-images.sbgenomics.com/d3b-bixu/open-pedcan:latest
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the latest tag for analysis means that changes to the Dockerfile and changes to the packages/data HAVE to be separate PRs.

with:
entrypoint: ./download-data.sh
env:
OPENPEDCAN_URL: https://s3.amazonaws.com/d3b-openaccess-us-east-1-prd-pbta/open-targets
OPENPEDCAN_RELEASE: testing

- name: Run Analysis
uses: docker://pgc-images.sbgenomics.com/d3b-bixu/open-pedcan:analysisjob
uses: docker://pgc-images.sbgenomics.com/d3b-bixu/open-pedcan:latest
with:
entrypoint: analyses/${{ matrix.entrypoint }}
env:
OPENPBTA_SUBSET: ${{ matrix.openpbta_subset }}
OPENPBTA_TESTING: ${{ matrix.openpbta_testing }}
RUN_FOR_SUBTYPING: ${{ matrix.run_for_subtyping }}
OPENPEDCAN_POLYA_STRAND: ${{ matrix.openpedcan_polya_strand }}
OPENPEDCAN_POLYA_STRAND: ${{ matrix.openpedcan_polya_strand }}