Skip to content

fix: find expression + add new image file type (#2971) #558

fix: find expression + add new image file type (#2971)

fix: find expression + add new image file type (#2971) #558

name: Check github workflow
on:
push:
paths:
- ".github/**"
branches:
- main
pull_request:
branches:
- main
paths:
- ".github/**"
types:
- 'opened'
- 'synchronize'
- 'reopened'
- 'labeled'
workflow_dispatch:
inputs:
nebius:
required: false
type: choice
default: "no"
description: "Run on nebius runners"
options:
- "yes"
- "no"
allow_downgrade:
description: 'Allow downgrade'
required: false
type: choice
default: "no"
options:
- "yes"
- "no"
large_tests:
description: 'Launch large tests'
required: false
type: choice
default: "no"
options:
- "yes"
- "no"
defaults:
run:
shell: bash
env:
nebius: ${{ vars.GLOBAL_RUN_ON_NEBIUS == 'yes' || ((github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'nebius')) || inputs.nebius == 'yes') }}
allow_downgrade: ${{ vars.GLOBAL_ALLOW_DOWNGRADE == 'yes' || ((github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'allow-downgrade')) || inputs.allow_downgrade == 'yes') }}
large_tests: ${{ (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'large-tests')) && 'true' || inputs.large_tests == 'yes' }}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
set-env:
runs-on: ubuntu-latest
outputs:
nebius: ${{ env.nebius == 'false' && 'no' || 'yes' }}
allow_downgrade: ${{ env.allow_downgrade == 'false' && 'no' || 'yes' }}
large_tests: ${{ env.large_tests == 'false' && 'no' || 'yes' }}
# we don't need anything, but otherwise github will complain
steps:
- name: set env
id: set-env
run: echo
shell:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
- name: get reporter name
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: "github-pr-review"
if_false: "github-check"
- name: set up dependencies
run: pip install pyyaml
- name: generate shellscripts from github actions
run: |
python .github/scripts/shell-extractor.py
find .temporary/ -type f -name "*.sh";
- name: shellcheck for .github dir
uses: ludeeus/action-shellcheck@master
with:
scandir: .github
env:
SHELLCHECK_OPTS: "-e SC2155,SC2086,SC2154,SC2164,SC2009,SC2015"
- name: shellcheck for github actions shell scripts in .temporary dir
uses: ludeeus/action-shellcheck@master
env:
SHELLCHECK_OPTS: "-e SC2155,SC2086,SC2154,SC2164,SC2009,SC2015"
with:
scandir: .temporary
- name: shfmt
uses: librarian/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: .github/
shfmt_flags: "-i 4 -ci -kp -bn -sr"
python:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
- name: get reporter name
uses: haya14busa/action-cond@v1
id: reporter
with:
cond: ${{ github.event_name == 'pull_request' }}
if_true: "github-pr-review"
if_false: "github-check"
- name: set up python environment
uses: actions/[email protected]
with:
python-version: "3.10"
- name: set up dependencies
run: pip install flake8 black[jupyter] flake8-docstrings flake8-simplify flake8-unused-arguments flake8-quotes
- name: flake8
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: .github/
reporter: ${{ steps.reporter.outputs.value }}
flake8_args: "--max-line-length 128 --ignore Q000,D100,D101,D102,D103,D104,D105,D106,D107"
- name: black
uses: reviewdog/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workdir: .github/
reporter: ${{ steps.reporter.outputs.value }}
workflows:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
- name: install action-validator with asdf
uses: asdf-vm/actions/install@v3
with:
tool_versions: |
action-validator 0.5.4
- name: check workflows syntax
id: lint
run: |
set -x
export TMP_OUT=$(mktemp)
find .github/workflows -type f \( -iname \*.yaml -o -iname \*.yml \) -print0 \
| xargs -0 -I {} action-validator --verbose {} > $TMP_OUT
echo "WORKFLOW_LINT=$(cat $TMP_OUT | awk -v ORS='\\n' 1)"
cat $TMP_OUT >> "$GITHUB_STEP_SUMMARY"
echo "WORKFLOW_LINT=$(cat $TMP_OUT | awk -v ORS='\\n' 1)" >> "$GITHUB_OUTPUT"
- name: comment on issue
uses: actions/[email protected]
if: ${{ github.event_name == 'pull_request' }}
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '${{ steps.lint.outputs.WORKFLOW_LINT }}'
})
nbs-github-actions:
name: Launch scripts on test-data
uses: ./.github/workflows/github_actions_scripts.yaml
secrets: inherit
create-and-delete-vm:
name: Create and delete VM
uses: ./.github/workflows/create_and_delete_vm.yaml
needs:
- set-env
with:
nebius: ${{ needs.set-env.outputs.nebius }}
allow_downgrade: ${{ needs.set-env.outputs.allow_downgrade }}
large_tests: ${{ needs.set-env.outputs.large_tests }}
secrets: inherit