Skip to content

Commit

Permalink
Facilitate contributor CI run for contributor PR
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed Nov 25, 2022
1 parent bd777e6 commit b6e13bc
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/contributor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Contributor Tests trigger

on:
issue_comment:
types: [created, edited]

permissions:
contents: write
pull-requests: write

jobs:
build:
name: Build
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/bot run tests') && contains(fromJson('["OWNER", "COLLABORATOR", "MEMBER"]'), github.event.comment.author_association)}}
runs-on: ubuntu-latest

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

- name: Create comment on the PR
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.issue.number }}
body: |
Contributor Tests Triggered by @${{ github.event.comment.user.login }}
- via [comment](${{ github.event.comment.html_url }})
- Build is running [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
reactions: 'rocket'

kubernetes-tests:
name: "Contributor #${{ github.event.issue.number }}"
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/bot run tests') && contains(fromJson('["OWNER", "COLLABORATOR", "MEMBER"]'), github.event.comment.author_association)}}
uses: nebari-dev/nebari/.github/workflows/kubernetes_test.yaml@release/2022.11.1
with:
pr_number: ${{ github.event.issue.number }}

infracost-tests:
name: "Contributor #${{ github.event.issue.number }}"
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/bot run tests') && contains(fromJson('["OWNER", "COLLABORATOR", "MEMBER"]'), github.event.comment.author_association)}}
uses: nebari-dev/nebari/.github/workflows/infracost.yml@release/2022.11.1
with:
pr_number: ${{ github.event.issue.number }}

provider-tests:
name: "Contributor #${{ github.event.issue.number }}"
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/bot run tests') && contains(fromJson('["OWNER", "COLLABORATOR", "MEMBER"]'), github.event.comment.author_association)}}
uses: nebari-dev/nebari/.github/workflows/test-provider.yaml@release/2022.11.1
with:
pr_number: ${{ github.event.issue.number }}
11 changes: 11 additions & 0 deletions .github/workflows/infracost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
paths:
- 'nebari/template/stages/02-infrastructure'
- '.github/workflows/infracost.yml'
workflow_call:
inputs:
pr_number:
required: true
type: string

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -38,6 +43,12 @@ jobs:
with:
ref: '${{ github.event.pull_request.base.ref }}'

- name: Checkout the branch from the PR that triggered the job
if: ${{ github.event_name == 'issue_comment' }}
run: hub pr checkout ${{ inputs.pr_number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Detects changes in the infrastructure for each specific cloud service provider
- name: Detect changed infrastructure
uses: dorny/paths-filter@v2
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/kubernetes_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ on:
- "nebari/**"
- "setup.cfg"
- "pyproject.yoml"
workflow_call:
inputs:
pr_number:
required: true
type: string

jobs:
test-kubernetes:
Expand All @@ -33,14 +38,23 @@ jobs:
run:
shell: bash -l {0}
steps:

- name: "Set NEBARI_IMAGE_TAG=main"
run: |
echo "NEBARI_IMAGE_TAG=main" >> "$GITHUB_ENV"
echo "GITHUB_BASE_REF: ${GITHUB_BASE_REF}"
echo "GITHUB_HEAD_REF: ${GITHUB_HEAD_REF}"
echo "GITHUB_REF: ${GITHUB_REF}"
- name: 'Checkout Infrastructure'
uses: actions/checkout@main

- name: Checkout the branch from the PR that triggered the job
if: ${{ github.event_name == 'issue_comment' }}
run: hub pr checkout ${{ inputs.pr_number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: conda-incubator/setup-miniconda@v2
env:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/test-provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ on:
- "nebari/**"
- "setup.cfg"
- "pyproject.yoml"
workflow_call:
inputs:
pr_number:
required: true
type: string

env:
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
Expand Down Expand Up @@ -55,6 +60,13 @@ jobs:
steps:
- name: 'Checkout Infrastructure'
uses: actions/checkout@main

- name: Checkout the branch from the PR that triggered the job
if: ${{ github.event_name == 'issue_comment' }}
run: hub pr checkout ${{ inputs.pr_number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v1
with:
Expand Down

0 comments on commit b6e13bc

Please sign in to comment.