From eefca00740becdf840cffff08aba04b28191743f Mon Sep 17 00:00:00 2001 From: Stanislav Dzisiak Date: Wed, 4 Sep 2024 17:25:58 +0300 Subject: [PATCH] create build workflow --- .github/workflows/build.yml | 77 +++++++++++++++++++++++++++++++++++++ eslint/app/test | 1 + multi-language/test | 1 + phpcs/app/test | 1 + 4 files changed, 80 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 eslint/app/test create mode 100644 multi-language/test create mode 100644 phpcs/app/test diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ff382d7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,77 @@ +name: build + +on: + push: + branches: + # - main + - create-workflow + +jobs: + prepare: + runs-on: ubuntu-latest + outputs: + directories: ${{ steps.set_directories.outputs.directories }} + + steps: + - uses: actions/checkout@v4 + + - uses: dorny/paths-filter@v3 + id: changes + with: + filters: | + multi-language: + - 'multi-language/**' + checkstyle: + - 'checkstyle/**' + sqlint: + - 'sqlint/**' + phpcs: + - 'phpcs/**' + layout-designer-lint: + - 'layout-designer-lint/**' + python-flake8: + - 'python-flake8/**' + golangci-lint: + - 'golangci-lint/**' + rubocop: + - 'rubocop/**' + eslint: + - 'eslint/**' + nulllint: + - 'nulllint/**' + + - id: set_directories + run: echo "directories=${{ toJson(steps.changes.outputs.changes) }}" >> "$GITHUB_OUTPUT" + + build: + needs: prepare + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + directory: ${{ fromJson(needs.prepare.outputs.directories) }} + + steps: + - name: Checkout repository + run: echo "${{ matrix.directory }}" + + - run: sleep 3 + if: matrix.directory != 'phpcs' + + - run: exit 1 + if: matrix.directory == 'phpcs' + + # - name: Set linter directories + # run: | + # IFS=' ' LINTER_DIRS=($(find . -maxdepth 1 -type d -not -name '.*' -exec basename {} \; | tr '\n' ' ')) + + # - run: for i in $LINTER_DIRS; do echo "--$i--"; done + + # - run: echo "${{ toJson(steps.changes.outputs.changes) }}" | jq -r '.[]' + # - run: | + # LINTER_DIRS=$(echo "${{ toJson(steps.changes.outputs.changes) }}" | jq -r '.[]') + # for element in $LINTER_DIRS; + # do + # echo "Содержимое каталога $element:"; + # ls "$element"; + # done diff --git a/eslint/app/test b/eslint/app/test new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/eslint/app/test @@ -0,0 +1 @@ +1 diff --git a/multi-language/test b/multi-language/test new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/multi-language/test @@ -0,0 +1 @@ +1 diff --git a/phpcs/app/test b/phpcs/app/test new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/phpcs/app/test @@ -0,0 +1 @@ +1