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

Facilitate CI run for contributor PR #1568

Merged
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
4 changes: 2 additions & 2 deletions .cirun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ runners:
cloud: aws
# Instance Type has 4 vcpu, 16 GiB memory, Up to 5 Gbps Network Performance
instance_type: t3a.xlarge
# Custom AMI with docker is pre-installed
machine_image: ami-0ff297f01f579288c
# Custom AMI with docker/cypress/hub pre-installed
machine_image: ami-0cdc9ef51d44597ce
# Region: Oregon
region: us-west-2
# Use Spot Instances for cost savings
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/contributor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
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 }}
secrets: inherit

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 }}
secrets: inherit

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 }}
secrets: inherit
12 changes: 12 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 All @@ -16,6 +21,7 @@ env:

jobs:
infracost:
if: github.event.pull_request.head.repo.name == github.repository || github.event_name != 'pull_request'
name: Run Infracost on Nebari Infrastructure
runs-on: ubuntu-latest

Expand All @@ -38,6 +44,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
19 changes: 18 additions & 1 deletion .github/workflows/kubernetes_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- "scripts/**"
- "nebari/**"
- "setup.cfg"
- "pyproject.yoml"
- "pyproject.toml"
push:
branches:
- main
Expand All @@ -24,23 +24,40 @@ on:
- "nebari/**"
- "setup.cfg"
- "pyproject.yoml"
workflow_call:
inputs:
pr_number:
required: true
type: string

jobs:
test-kubernetes:
if: github.event.pull_request.head.repo.name == github.repository || github.event_name != 'pull_request'
name: "Kubernetes Tests"
runs-on: "cirun-runner--${{ github.run_id }}"
defaults:
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 version
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
13 changes: 13 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 All @@ -37,6 +42,7 @@ env:

jobs:
test-render-providers:
if: github.event.pull_request.head.repo.name == github.repository || github.event_name != 'pull_request'
name: 'Test Nebari Provider'
runs-on: ubuntu-latest
strategy:
Expand All @@ -55,6 +61,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