Skip to content

Tgc compute

Tgc compute #6816

Workflow file for this run

name: mmv1
permissions: read-all
on:
push:
branches:
- main
- 'FEATURE-BRANCH-*'
merge_group:
types: [checks_requested]
pull_request:
concurrency:
group: ${{ github.event_name == 'merge_group' && format('mmv1-merge-group-{0}', github.event.merge_group.head_sha) || github.event_name == 'pull_request' && format('mmv1-pr-{0}', github.event.pull_request.number) || format('mmv1-commit-{0}', github.sha) }}
cancel-in-progress: true
jobs:
version-guard-check:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
with:
path: repo
fetch-depth: 0
- name: Merge base branch
if: github.event_name == 'pull_request'
run: |
cd repo
git config user.name "modular-magician"
git config user.email "[email protected]"
git fetch origin ${{ github.base_ref }} # Fetch the base branch
git merge --no-ff origin/${{ github.base_ref }} # Merge with the base branch
- name: Check for invalid version guards
run: |
cd repo/tools/template-check
tmpls=$(git diff --name-only --diff-filter=d origin/${{ github.base_ref }} ../../*.tmpl | sed 's=^=../../=g')
tmpls=${tmpls//$'\n'/,}
echo $tmpls
if [[ -n "$tmpls" ]]; then
go run main.go version-guard --file-list $tmpls
fi
lint-yaml:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
with:
path: repo
fetch-depth: 0
- name: Merge base branch
if: github.event_name == 'pull_request'
run: |
cd repo
git config user.name "modular-magician"
git config user.email "[email protected]"
git fetch origin ${{ github.base_ref }}
git merge --no-ff origin/${{ github.base_ref }}
- name: Find YAML files to lint
id: yaml_files
run: |
cd repo
if [ "${{ github.event_name }}" == "pull_request" ]; then
# For PRs, get only changed files
yamlfiles=$(git diff --name-only origin/${{ github.base_ref }} -- mmv1/products)
if [ ! -z "$yamlfiles" ]; then
echo "yamlfiles=${yamlfiles//$'\n'/ }" >> $GITHUB_OUTPUT
fi
else
# For other events, get all YAML files
yamlfiles=$(find mmv1/products -name "*.yaml" -o -name "*.yml" | tr '\n' ' ')
if [ ! -z "$yamlfiles" ]; then
echo "yamlfiles=$yamlfiles" >> $GITHUB_OUTPUT
fi
fi
- name: Install yamllint
if: ${{ !failure() && steps.yaml_files.outputs.yamlfiles != '' }}
run: pip install yamllint==1.32.0 pyyaml==6.0.1 pathspec==0.12.1 --no-deps
- name: Lint YAML files
if: ${{ !failure() && steps.yaml_files.outputs.yamlfiles != '' }}
run: |
cd repo
yamllint -c .yamllint ${{ steps.yaml_files.outputs.yamlfiles }}
unit-tests:
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
with:
path: repo
fetch-depth: 0
- name: Merge base branch
if: github.event_name == 'pull_request'
run: |
cd repo
git config user.name "modular-magician"
git config user.email "[email protected]"
git fetch origin ${{ github.base_ref }} # Fetch the base branch
git merge --no-ff origin/${{ github.base_ref }} # Merge with the base branch
- name: Set up Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '^1.23'
- name: Run mmv1 unit tests
run: |
cd repo
cd mmv1
go test ./...