Версия 2.5.0 #584
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Контроль качества | |
on: | |
push: | |
pull_request_target: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
sonar: | |
if: (github.repository == 'vanessa-opensource/vanessa-runner') | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
oscript_version: ['stable'] | |
v8_version: ['8.3.23.1997'] | |
locale: ['ru_RU'] | |
steps: | |
- name: Актуализация | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
fetch-depth: 0 | |
- name: Вычисление имени ветки | |
uses: nelonoel/[email protected] | |
- name: Вычисление версии OneScript | |
shell: bash | |
id: extract_oscript_version | |
run: | | |
set -ex | |
if [ "${{ matrix.oscript_version }}" = "default" ] | |
then | |
extracted_version=$(cat packagedef | grep ".ВерсияСреды(" | sed 's|[^"]*"||' | sed -r 's/".+//' || true) | |
version="${extracted_version:-stable}" | |
else | |
version="${{ matrix.oscript_version }}" | |
fi | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Установка OneScript | |
uses: otymko/[email protected] | |
with: | |
version: ${{ steps.extract_oscript_version.outputs.version }} | |
- name: Установка зависимостей пакета | |
run: | | |
opm install opm | |
opm install -l --dev | |
- name: Установка дополнительных пакетов | |
run: opm install add | |
- name: Установка 1С:Предприятие | |
if: matrix.v8_version != '' | |
uses: 1CDevFlow/onec-setup-action@main | |
with: | |
type: onec # Тип устанавливаемого приложения | |
onec_version: ${{ matrix.v8_version }} | |
cache: false | |
env: | |
ONEC_USERNAME: ${{ secrets.ONEC_USERNAME }} | |
ONEC_PASSWORD: ${{ secrets.ONEC_PASSWORD }} | |
- name: Подготовка окружения (Linux) | |
run: | | |
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y locales | |
sudo ln -s /usr/lib/x86_64-linux-gnu/libenchant-2.so.2 /usr/lib/libenchant.so.1 | |
sudo localedef -i ${{ matrix.locale }} -c -f UTF-8 -A /usr/share/locale/locale.alias ${{ matrix.locale }}.UTF-8 | |
- name: Установка лицензии (Linux) | |
run: | | |
# Создание каталога | |
sudo mkdir -p /var/1C/licenses | |
# Запись лицензии в файл | |
echo "${{ secrets.ONEC_LICENCE }}" | sudo tee /var/1C/licenses/licence.lic > /dev/null | |
# Назначение прав | |
sudo chmod 777 -R /var/1C/licenses | |
shell: bash | |
env: | |
ONEC_LICENCE: ${{ secrets.ONEC_LICENCE }} | |
- name: Создание файла конфигурации conf.cfg (Linux) | |
run: | | |
sudo mkdir -p /opt/1cv8/conf/ | |
sudo tee /opt/1cv8/conf/conf.cfg > /dev/null <<EOF | |
DisableUnsafeActionProtection=.* | |
SystemLanguage=System | |
EOF | |
# Назначение прав | |
sudo chmod 777 -R /opt/1cv8/conf/ | |
- name: Запуск тестов | |
uses: coactions/setup-xvfb@v1 | |
with: | |
run: oscript ./tasks/coverage.os | |
- name: Извлечение версии пакета | |
shell: bash | |
run: echo "version=`cat packagedef | grep ".Версия(" | sed 's|[^"]*"||' | sed -r 's/".+//'`" >> $GITHUB_OUTPUT | |
id: extract_version | |
- name: Настройка sonar-scanner | |
uses: warchant/setup-sonar-scanner@v8 | |
- name: Анализ в SonarQube (branch) | |
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} | |
SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }} | |
run: sonar-scanner | |
-Dsonar.host.url=${{ env.SONARQUBE_HOST }} | |
-Dsonar.branch.name=${{ env.BRANCH_NAME }} | |
-Dsonar.projectVersion=${{ steps.extract_version.outputs.version }} | |
# https://docs.sonarqube.org/latest/analysis/pull-request/ | |
- name: Анализ в SonarQube (pull-request) | |
if: github.event_name == 'pull_request_target' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} | |
SONARQUBE_HOST: ${{ secrets.SONARQUBE_HOST }} | |
run: sonar-scanner | |
-Dsonar.host.url=${{ env.SONARQUBE_HOST }} | |
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} | |
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} | |
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} | |
-Dsonar.scm.revision=${{ github.event.pull_request.head.sha }} |