Skip to content

Commit d5d4f7f

Browse files
author
Your Name
committed
upd workflows
1 parent 6f28c2d commit d5d4f7f

File tree

3 files changed

+208
-51
lines changed

3 files changed

+208
-51
lines changed

.github/workflows/qa.yml

Lines changed: 107 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,115 @@
1+
# MIT License
2+
# Copyright (C) 2020 Tymko Oleg <olegtymko@yandex.ru> and contributors
3+
# All rights reserved.
4+
15
name: Контроль качества
26

37
on:
48
push:
5-
pull_request:
9+
pull_request_target:
610
workflow_dispatch:
711

812
jobs:
913
sonar:
10-
uses: autumn-library/workflows/.github/workflows/sonar.yml@main
11-
with:
12-
github_repository: oscript-library/gitsync
13-
secrets:
14-
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
14+
if: github.repository == 'oscript-library/gitsync'
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-22.04]
20+
oscript_version: ['1.9.2']
21+
v8_version: ['8.3.24.1691']
22+
locale: ['ru_RU']
23+
24+
steps:
25+
- name: Актуализация
26+
uses: actions/checkout@v4.2.2
27+
with:
28+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
29+
ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
30+
fetch-depth: 0
31+
32+
# https://stackoverflow.com/questions/58033366/how-to-get-current-branch-within-github-actions
33+
- name: Извлечение имени текущей ветки
34+
shell: bash
35+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
36+
id: extract_branch
37+
38+
- name: Установка OneScript
39+
uses: otymko/setup-onescript@v1.5
40+
with:
41+
version: ${{ matrix.oscript_version }}
42+
43+
- name: Установка зависимостей
44+
run: |
45+
opm install opm
46+
opm install --dev
47+
48+
- name: Подготовка окружения (Linux)
49+
if: startsWith(matrix.os, 'ubuntu')
50+
run: |
51+
sudo apt-get update
52+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y locales libwebkit2gtk-4.0-37
53+
sudo localedef -i ${{ matrix.locale }} -c -f UTF-8 -A /usr/share/locale/locale.alias ${{ matrix.locale }}.UTF-8
54+
55+
- name: Установка платформы 1С
56+
uses: 1CDevFlow/onec-setup-action@main
57+
with:
58+
type: onec # Тип устанавливаемого приложения
59+
onec_version: ${{ matrix.v8_version }}
60+
cache: true
61+
cache_distr: true
62+
env:
63+
ONEC_USERNAME: ${{ secrets.ONEC_USERNAME }}
64+
ONEC_PASSWORD: ${{ secrets.ONEC_PASSWORD }}
65+
66+
- name: Установка лицензии (Linux)
67+
if: startsWith(matrix.os, 'ubuntu')
68+
run: |
69+
# Создание каталога
70+
sudo mkdir -p /var/1C/licenses
71+
72+
# Запись лицензии в файл
73+
echo "${{ secrets.ONEC_LICENSE }}" | sudo tee /var/1C/licenses/licence.lic > /dev/null
74+
75+
# Назначение прав
76+
sudo chmod 777 -R /var/1C/licenses
77+
shell: bash
78+
env:
79+
ONEC_LICENSE: ${{ secrets.ONEC_LICENSE }}
80+
81+
- name: Покрытие кода
82+
uses: coactions/setup-xvfb@v1
83+
env:
84+
GITSYNC_V8VERSION: ${{ matrix.v8_version }}
85+
with:
86+
run: opm run coverage
87+
88+
- name: Извлечение версии пакета
89+
shell: bash
90+
run: echo "##[set-output name=version;]`cat packagedef | grep ".Версия(" | sed 's|[^"]*"||' | sed -r 's/".+//'`"
91+
id: extract_version
92+
93+
- name: Установка sonar-scanner
94+
uses: warchant/setup-sonar-scanner@v8
95+
96+
- name: Анализ в SonarQube (branch)
97+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
98+
env:
99+
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
100+
run: sonar-scanner
101+
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
102+
-Dsonar.branch.name=${{ steps.extract_branch.outputs.branch }}
103+
-Dsonar.projectVersion=${{ steps.extract_version.outputs.version }}
104+
105+
# https://docs.sonarqube.org/latest/analysis/pull-request/
106+
- name: Анализ в SonarQube (pull-request)
107+
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
108+
env:
109+
SONAR_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
110+
run: sonar-scanner
111+
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }}
112+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
113+
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
114+
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}
115+
-Dsonar.scm.revision=${{ github.event.pull_request.head.sha }}

.github/workflows/release.yml

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,24 @@ name: Подготовка релиза и публикация в хабе
66
# Только события создания и изменения релиза
77
on:
88
release:
9-
types: [published]
9+
types: [published, edited]
1010
jobs:
1111
build:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest]
17-
oscript_version: ['1.9.0']
17+
oscript_version: ['1.9.2']
1818
package_mask: ["gitsync-*.ospx"]
19-
package_exe_mask: ["gitsync.exe"]
2019
steps:
2120
# Загрузка проекта
2221
- name: Актуализация
23-
uses: actions/checkout@v2
22+
uses: actions/checkout@v4.2.2
2423

2524
# Установка OneScript конкретной версии
2625
- name: Установка OneScript
27-
uses: otymko/setup-onescript@v1.0
28-
env:
29-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
26+
uses: otymko/setup-onescript@v1.5
3027
with:
3128
version: ${{ matrix.oscript_version }}
3229

@@ -39,14 +36,14 @@ jobs:
3936
- name: Сборка пакета
4037
run: opm run build
4138

42-
- name: Заливка артифактов
43-
uses: actions/upload-artifact@v2
39+
- name: Заливка артефактов
40+
uses: actions/upload-artifact@v6.0.0
4441
with:
4542
name: gitsync.ospx.zip
4643
path: ./${{ matrix.package_mask }}
4744

4845
- name: Заливка в релиз
49-
uses: AButler/upload-release-assets@v1.0
46+
uses: AButler/upload-release-assets@v3.0.1
5047
with:
5148
files: ./${{ matrix.package_mask }}
5249
repo-token: ${{ secrets.GITHUB_TOKEN }}
@@ -55,21 +52,4 @@ jobs:
5552
shell: bash
5653
run: opm push -f ./${{ matrix.package_mask }} --token ${{ env.TOKEN }} -c stable
5754
env:
58-
TOKEN: ${{ secrets.OSHUB_TOKEN }}
59-
60-
- name: Сборка пакета exe
61-
run: |
62-
opm run pack
63-
opm run make
64-
65-
- name: Заливка артифактов
66-
uses: actions/upload-artifact@v2
67-
with:
68-
name: gitsync.exe.zip
69-
path: ./bin/${{ matrix.package_exe_mask }}
70-
71-
- name: Заливка в релиз exe
72-
uses: AButler/upload-release-assets@v1.0
73-
with:
74-
files: ./bin/${{ matrix.package_exe_mask }}
75-
repo-token: ${{ secrets.GITHUB_TOKEN }}
55+
TOKEN: ${{ secrets.ACCESS_TOKEN }}

.github/workflows/testing.yml

Lines changed: 93 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,113 @@
33
# All rights reserved.
44

55
name: Тестирование
6-
# Любой пуш и pr в проекте
7-
on: [push, pull_request]
6+
7+
on:
8+
push:
9+
pull_request_target:
10+
workflow_dispatch:
11+
12+
permissions:
13+
checks: write
14+
pull-requests: write
815

916
jobs:
10-
build:
17+
test:
1118
runs-on: ${{ matrix.os }}
1219
strategy:
13-
fail-fast: false
1420
matrix:
15-
os: [ubuntu-latest]
16-
oscript_version: ['1.9.0']
17-
21+
oscript_version: ['1.9.2']
22+
v8_version: ['8.3.21.1624', '8.3.24.1691']
23+
os: [windows-latest, ubuntu-22.04]
24+
locale: ['ru_RU']
25+
fail-fast: false
1826
steps:
19-
# Загрузка проекта
27+
- name: Установка локали
28+
if: matrix.os == startsWith(matrix.os, 'windows')
29+
run: |
30+
powershell -Command "Set-WinUILanguageOverride -Language ru-RU"
31+
powershell -Command "Set-WinUserLanguageList ru-RU -Force"
32+
powershell -Command "Set-Culture ru-RU"
33+
powershell -Command "Set-WinSystemLocale ru-RU"
34+
2035
- name: Актуализация
21-
uses: actions/checkout@v2
36+
uses: actions/checkout@v4.2.2
37+
with:
38+
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
39+
ref: ${{ github.event.pull_request.head.ref || github.ref_name }}
2240

23-
# Установка OneScript конкретной версии
2441
- name: Установка OneScript
25-
uses: otymko/setup-onescript@v1.0
26-
env:
27-
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
42+
uses: otymko/setup-onescript@v1.5
2843
with:
2944
version: ${{ matrix.oscript_version }}
3045

31-
# Установка зависимостей пакета
3246
- name: Установка зависимостей
3347
run: |
3448
opm install opm
3549
opm install -l --dev
36-
37-
# Задача тестирования, в результате ожидается успешное выполнение
50+
51+
- name: Подготовка окружения (Linux)
52+
if: startsWith(matrix.os, 'ubuntu')
53+
run: |
54+
sudo apt-get update
55+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y locales libwebkit2gtk-4.0-37 libgl1-mesa-dri libgl1-mesa-glx mesa-utils
56+
sudo localedef -i ${{ matrix.locale }} -c -f UTF-8 -A /usr/share/locale/locale.alias ${{ matrix.locale }}.UTF-8
57+
58+
- name: Установка libenchant1c2a для 8.3.21 (Linux)
59+
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.v8_version, '8.3.21')
60+
run: |
61+
sudo echo "deb http://cz.archive.ubuntu.com/ubuntu focal main universe" | sudo tee -a /etc/apt/sources.list
62+
sudo apt-get update
63+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y libenchant1c2a
64+
65+
- name: Установка платформы 1С
66+
uses: 1CDevFlow/onec-setup-action@main
67+
with:
68+
type: onec # Тип устанавливаемого приложения
69+
onec_version: ${{ matrix.v8_version }}
70+
cache: true
71+
cache_distr: true
72+
env:
73+
ONEC_USERNAME: ${{ secrets.ONEC_USERNAME }}
74+
ONEC_PASSWORD: ${{ secrets.ONEC_PASSWORD }}
75+
76+
- name: Установка лицензии (Linux)
77+
if: startsWith(matrix.os, 'ubuntu')
78+
run: |
79+
# Создание каталога
80+
sudo mkdir -p /var/1C/licenses
81+
82+
# Запись лицензии в файл
83+
echo "${{ secrets.ONEC_LICENSE }}" | sudo tee /var/1C/licenses/licence.lic > /dev/null
84+
85+
# Назначение прав
86+
sudo chmod 777 -R /var/1C/licenses
87+
shell: bash
88+
env:
89+
ONEC_LICENSE: ${{ secrets.ONEC_LICENSE }}
90+
91+
- name: Установка лицензии (Windows)
92+
if: startsWith(matrix.os, 'windows')
93+
run: |
94+
mkdir "C:\ProgramData\1C\licenses" -Force
95+
echo $Env:ONEC_LICENSE | Out-File -FilePath "C:\ProgramData\1C\licenses\licence.lic" -Encoding ascii
96+
shell: pwsh
97+
env:
98+
ONEC_LICENSE: ${{ secrets.ONEC_LICENSE }}
99+
38100
- name: Тестирование
39-
run: oscript ./tasks/test.os true
101+
uses: coactions/setup-xvfb@v1
102+
env:
103+
GITSYNC_V8VERSION: ${{ matrix.v8_version }}
104+
with:
105+
run: oscript ./tasks/test.os
106+
107+
- name: Публикация отчета
108+
if: success() || failure()
109+
uses: mikepenz/action-junit-report@v6.0.1
110+
with:
111+
report_paths: '**/build/reports/*.xml'
112+
fail_on_failure: true
113+
require_passed_tests: true
114+
comment: true
115+
check_name: 'Результаты тестов. ОС: ${{ matrix.os }}. Версия 1С: ${{ matrix.v8_version }}. Версия OneScript: ${{ matrix.oscript_version }}'

0 commit comments

Comments
 (0)