Skip to content

Commit

Permalink
Merge branch 'main' into tylertitsworth/perf-thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Titsworth authored May 30, 2024
2 parents 4924f82 + 06318e9 commit 6cd9058
Show file tree
Hide file tree
Showing 13 changed files with 238 additions and 150 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/chart-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright (c) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Helm Chart CI
on:
pull_request: null
# pull_request_target:
# types: [opened, edited, reopened, synchronize]
# branches: [main]
merge_group: null
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
helm-ci:
runs-on: kubectl
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# ref: ${{ github.event.pull_request.head.ref || github.ref }}
- uses: azure/setup-kubectl@v4
- uses: azure/[email protected]
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Setup chart-testing
uses: helm/[email protected]
- name: Get chart diff
id: changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }} --config .github/ct.yaml)
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Helm Lint, Install, and Test
if: steps.changed.outputs.changed == 'true'
run: |
kubectl config use-context kubeflow
ct lint-and-install --target-branch ${{ github.event.repository.default_branch }} --config .github/ct.yaml --debug --namespace helm-ci
env:
KUBECONFIG: ${{ secrets.KUBECONFIG_PATH }}
17 changes: 17 additions & 0 deletions .github/workflows/container-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ on:
description: 'Enter Bash Env Variable Overrides in `KEY=VAL KEY2=VAL2` format:'
required: false
type: string
ref:
description: 'Enter Git Ref:'
required: true
type: string
runner_label:
description: 'Enter Validation Runner Label:'
default: test-runner
Expand Down Expand Up @@ -66,6 +70,9 @@ on:
no_start:
required: false
type: boolean
ref:
required: true
type: string
jobs:
####################################################################################################
# Compose Build
Expand All @@ -76,6 +83,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Set Matrix
id: build-matrix
run: echo "matrix=$(jq -c . < ${{ inputs.group_dir }}/.actions.json)" >> $GITHUB_OUTPUT
Expand All @@ -93,6 +102,8 @@ jobs:
group: ${{ steps.build-group.outputs.container-group }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
if: ${{ !inputs.no_build }}
- uses: docker/login-action@v3
with:
Expand Down Expand Up @@ -136,6 +147,8 @@ jobs:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY }}
Expand Down Expand Up @@ -164,6 +177,8 @@ jobs:
matrix: ${{ steps.test-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Get Recipes
id: test-matrix
run: echo "matrix=$(find ${{ inputs.group_dir }} -type f -name 'tests.yaml' -exec dirname {} \; | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
Expand All @@ -181,6 +196,8 @@ jobs:
with:
egress-policy: audit
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: docker/login-action@v3
with:
registry: ${{ secrets.REGISTRY }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/dependency-review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ on: [pull_request]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
jobs:
dependency-review:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/dependency-review-action@v4
with:
comment-summary-in-pr: true
- uses: actions/checkout@v4
- uses: actions/dependency-review-action@v4
with:
comment-summary-in-pr: true
24 changes: 12 additions & 12 deletions .github/workflows/dockerhub-description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,29 @@
name: Docker Description Publish
on:
push:
branches: [ "main" ]
branches: ["main"]
permissions: read-all
jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- name: Set matrix data
id: set-matrix
run: echo "matrix=$(jq -c . < .github/dockerhub-readmes.json)" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- name: Set matrix data
id: set-matrix
run: echo "matrix=$(jq -c . < .github/dockerhub-readmes.json)" >> $GITHUB_OUTPUT
publish-dockerhub-description:
runs-on: ubuntu-latest
needs: setup-matrix
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ matrix.readmes.repo-name }}
readme-filepath: ${{ matrix.readmes.fname }}
- uses: actions/checkout@v4
- uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ matrix.readmes.repo-name }}
readme-filepath: ${{ matrix.readmes.fname }}
30 changes: 15 additions & 15 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
- main
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
mkdocs:
Expand All @@ -31,17 +31,17 @@ jobs:
id-token: write
pages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
cache: pip
- name: Install python requirements
run: python -m pip install -r docs/requirements.txt
- name: Build
run: mkdocs build --clean
- uses: actions/upload-pages-artifact@v3
with:
path: site
- if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: actions/deploy-pages@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
cache: pip
- name: Install python requirements
run: python -m pip install -r docs/requirements.txt
- name: Build
run: mkdocs build --clean
- uses: actions/upload-pages-artifact@v3
with:
path: site
- if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
uses: actions/deploy-pages@v4
21 changes: 12 additions & 9 deletions .github/workflows/gitleaks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@ name: gitleaks
on:
push:
branches:
- main
pull_request: null
- main
pull_request_target:
types: [opened, edited, reopened, synchronize]
branches: [main]
workflow_dispatch: null
permissions: read-all
jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}}
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE}}
81 changes: 42 additions & 39 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,51 @@
# See the License for the specific language governing permissions and
# limitations under the License.

---
name: Integration Tests
on:
merge_group: null
pull_request: null
pull_request_target:
types: [opened, edited, reopened, synchronize]
branches: [main]
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
group-diff:
runs-on: ubuntu-latest
outputs:
groups: ${{ steps.group-list.outputs.FOLDERS }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Output Modified Group Directories
id: group-list
run: |
# Get diff array filtered by specific filetypes
DIFF=$(git diff --diff-filter=d \
--name-only ${{ github.event.merge_group.base_sha || github.event.pull_request.base.sha }}...${{ github.event.merge_group.head_sha || github.event.pull_request.head.sha }} \
-- '*/*Dockerfile' '*.py' '*.yaml' '*.yml' '*.sh' '*/*requirements.txt' '*.json' | \
jq -R '.' | jq -sc '.' \
)
# Search for compose files in each file to determine the container groups
DOCKER_COMPOSE_PATHS=()
for path in $(echo $DIFF | jq -r '.[]'); do
while [[ "$path" != "." ]]; do
DIR_PATH=$(dirname "$path")
if [ -n "$(find "$DIR_PATH" -name 'docker-compose.yaml' -print -quit)" ] && [ "$DIR_PATH" != "." ]; then
DOCKER_COMPOSE_PATHS+=("$DIR_PATH")
path="."
else
path="$DIR_PATH"
fi
done
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref || github.ref }}
- name: Output Modified Group Directories
id: group-list
run: |
# Get diff array filtered by specific filetypes
DIFF=$(git diff --diff-filter=d \
--name-only ${{ github.event.merge_group.base_sha || github.event.pull_request.base.sha }}...${{ github.event.merge_group.head_sha || github.event.pull_request.head.sha }} \
-- '*/*Dockerfile' '*.py' '*.yaml' '*.yml' '*.sh' '*/*requirements.txt' '*.json' | \
jq -R '.' | jq -sc '.' \
)
# Search for compose files in each file to determine the container groups
DOCKER_COMPOSE_PATHS=()
for path in $(echo $DIFF | jq -r '.[]'); do
while [[ "$path" != "." ]]; do
DIR_PATH=$(dirname "$path")
if [ -n "$(find "$DIR_PATH" -name 'docker-compose.yaml' -print -quit)" ] && [ "$DIR_PATH" != "." ]; then
DOCKER_COMPOSE_PATHS+=("$DIR_PATH")
path="."
else
path="$DIR_PATH"
fi
done
# Convert the array to a JSON array
DOCKER_COMPOSE_PATHS_JSON=$(printf '%s\n' "${DOCKER_COMPOSE_PATHS[@]}" | jq -R '.' | jq -sc 'unique_by(.)')
echo "FOLDERS=$DOCKER_COMPOSE_PATHS_JSON" >> $GITHUB_OUTPUT
done
# Convert the array to a JSON array
DOCKER_COMPOSE_PATHS_JSON=$(printf '%s\n' "${DOCKER_COMPOSE_PATHS[@]}" | jq -R '.' | jq -sc 'unique_by(.)')
echo "FOLDERS=$DOCKER_COMPOSE_PATHS_JSON" >> $GITHUB_OUTPUT
pipeline-ci:
needs: group-diff
if: needs.group-diff.outputs.groups != '[""]'
Expand All @@ -66,17 +68,18 @@ jobs:
uses: ./.github/workflows/container-ci.yaml
with:
group_dir: ${{ matrix.group }}
ref: "refs/pull/${{ github.event.number }}/merge"
secrets: inherit
status-check:
needs: [ group-diff, pipeline-ci ]
needs: [group-diff, pipeline-ci]
runs-on: ubuntu-latest
if: always()
steps:
- run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
&& needs.group-diff.outputs.groups != '[""]'
}}
- run: exit 1
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
|| contains(needs.*.result, 'skipped')
&& needs.group-diff.outputs.groups != '[""]'
}}
Loading

0 comments on commit 6cd9058

Please sign in to comment.