2024-03-20 15:36:22 +02:00
|
|
|
|
|
|
|
name: Тестирование OINT CLI
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
Decode:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
2024-03-20 21:04:02 +02:00
|
|
|
- uses: actions/checkout@v4
|
2024-03-20 15:36:22 +02:00
|
|
|
|
|
|
|
- name: Расшифровать тестовые данные
|
|
|
|
run: gpg --quiet --batch --yes --decrypt --passphrase="$ENC_JSON" --output ./data.json ./data.json.gpg
|
|
|
|
env:
|
|
|
|
ENC_JSON: ${{ secrets.ENC_JSON }}
|
2024-03-20 20:09:56 +02:00
|
|
|
|
2024-03-20 20:57:29 +02:00
|
|
|
- name: Кэшировать данные
|
|
|
|
uses: actions/cache/save@v3
|
2024-03-20 15:36:22 +02:00
|
|
|
with:
|
2024-03-20 20:57:29 +02:00
|
|
|
path: ./data.json
|
2024-03-20 21:00:39 +02:00
|
|
|
key: test-data
|
2024-03-20 15:36:22 +02:00
|
|
|
|
2024-03-20 20:09:56 +02:00
|
|
|
Build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-03-20 21:04:02 +02:00
|
|
|
- uses: actions/checkout@v4
|
2024-03-20 20:09:56 +02:00
|
|
|
- uses: otymko/setup-onescript@v1.4
|
|
|
|
with:
|
|
|
|
version: 1.9.0
|
2024-03-20 20:15:04 +02:00
|
|
|
|
|
|
|
- name: Установить cmdline и asserts
|
|
|
|
run: |
|
|
|
|
opm install cmdline
|
|
|
|
opm install asserts
|
|
|
|
|
|
|
|
- name: Собрать и установить OInt
|
|
|
|
run: |
|
|
|
|
cd ./OInt
|
|
|
|
opm build
|
2024-03-21 07:49:51 +02:00
|
|
|
opm install *.ospx
|
2024-03-20 20:09:56 +02:00
|
|
|
|
|
|
|
- name: Собрать бинарник
|
|
|
|
run: |
|
|
|
|
cd ./cli
|
2024-03-22 09:46:13 +02:00
|
|
|
oscript -make core/Classes/Приложение.os oint_bin
|
2024-03-20 20:09:56 +02:00
|
|
|
|
|
|
|
- name: Записать артефакт
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: oint
|
2024-03-20 20:20:21 +02:00
|
|
|
path: ./cli/oint_bin
|
2024-03-20 20:09:56 +02:00
|
|
|
|
2024-03-20 15:36:22 +02:00
|
|
|
Testing-Telegram:
|
|
|
|
runs-on: ubuntu-latest
|
2024-03-20 20:09:56 +02:00
|
|
|
needs: [Decode, Build]
|
2024-03-20 15:36:22 +02:00
|
|
|
steps:
|
|
|
|
|
2024-03-20 21:00:39 +02:00
|
|
|
- name: Получить тестовые данные из кэша
|
2024-03-20 20:57:29 +02:00
|
|
|
uses: actions/cache/restore@v3
|
2024-03-20 15:36:22 +02:00
|
|
|
with:
|
2024-03-20 20:57:29 +02:00
|
|
|
path: ./data.json
|
2024-03-20 21:00:39 +02:00
|
|
|
key: test-data
|
2024-03-20 15:36:22 +02:00
|
|
|
|
2024-03-20 20:09:56 +02:00
|
|
|
- name: Скачать артефакт с исполняемым файлом
|
|
|
|
uses: actions/download-artifact@v4
|
|
|
|
with:
|
|
|
|
name: oint
|
|
|
|
|
2024-03-21 12:58:40 +02:00
|
|
|
- name: JSON в переменные
|
2024-03-20 15:36:22 +02:00
|
|
|
uses: rgarcia-phi/json-to-variables@v1.1.0
|
|
|
|
with:
|
|
|
|
filename: 'data.json'
|
|
|
|
masked: true
|
2024-03-20 20:33:10 +02:00
|
|
|
|
|
|
|
- name: chmod для OInt
|
|
|
|
run: chmod +x ./oint_bin
|
2024-03-21 12:58:40 +02:00
|
|
|
|
|
|
|
- name: Выполнить ПолучитьИнформациюБота
|
2024-03-20 20:09:56 +02:00
|
|
|
if: ${{ cancelled() }} == false
|
2024-03-20 20:22:45 +02:00
|
|
|
run: ./oint_bin telegram ПолучитьИнформациюБота --token ${{ env.json_Telegram_Token }}
|
2024-03-20 21:12:42 +02:00
|
|
|
|
2024-03-21 12:58:40 +02:00
|
|
|
- name: Выполнить ПолучитьОбновления
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: ./oint_bin telegram ПолучитьОбновления --token ${{ env.json_Telegram_Token }}
|
|
|
|
|
|
|
|
- name: Выполнить УстановитьWebhook
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: ./oint_bin telegram УстановитьWebhook --token ${{ env.json_Telegram_Token }} --url ${{ env.json_Telegram_URL }}
|
|
|
|
|
2024-03-21 14:11:30 +02:00
|
|
|
- name: Выполнить УдалитьWebhook
|
|
|
|
if: ${{ cancelled() }} == false
|
2024-03-22 12:20:59 +02:00
|
|
|
run: ./oint_bin telegram УдалитьWebhook --token ${{ env.json_Telegram_Token }}
|
2024-03-21 14:11:30 +02:00
|
|
|
|
2024-03-21 12:58:40 +02:00
|
|
|
- name: Выполнить ОтправитьТекстовоеСообщение
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram ОтправитьТекстовоеСообщение \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
2024-03-22 19:18:36 +02:00
|
|
|
--chat ${{ env.json_Telegram_ChatID }} \
|
2024-03-21 12:58:40 +02:00
|
|
|
--text "Тестовое сообщение"
|
|
|
|
|
2024-03-21 14:11:30 +02:00
|
|
|
- name: Выполнить ОтправитьКартинку
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram ОтправитьКартинку \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
2024-03-22 19:18:36 +02:00
|
|
|
--chat ${{ env.json_Telegram_ChatID }} \
|
2024-03-21 14:22:23 +02:00
|
|
|
--text "Тестовое сообщение" \
|
2024-03-21 14:16:12 +02:00
|
|
|
--path "${{ env.json_Picture }}"
|
2024-03-21 14:11:30 +02:00
|
|
|
|
|
|
|
- name: Выполнить ОтправитьВидео
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram ОтправитьВидео \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
2024-03-22 19:18:36 +02:00
|
|
|
--chat ${{ env.json_Telegram_ChatID }} \
|
2024-03-21 14:22:23 +02:00
|
|
|
--text "Тестовое сообщение" \
|
2024-03-21 14:11:30 +02:00
|
|
|
--path ${{ env.json_Video }}
|
|
|
|
|
|
|
|
- name: Выполнить ОтправитьГифку
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram ОтправитьГифку \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
2024-03-22 19:18:36 +02:00
|
|
|
--chat ${{ env.json_Telegram_ChatID }} \
|
2024-03-21 14:22:23 +02:00
|
|
|
--text "Тестовое сообщение" \
|
2024-03-21 14:11:30 +02:00
|
|
|
--path ${{ env.json_GIF }}
|
|
|
|
|
|
|
|
- name: Выполнить ОтправитьАудио
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram ОтправитьАудио \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
2024-03-22 19:18:36 +02:00
|
|
|
--chat ${{ env.json_Telegram_ChatID }} \
|
2024-03-21 14:22:23 +02:00
|
|
|
--text "Тестовое сообщение" \
|
2024-03-21 14:11:30 +02:00
|
|
|
--path ${{ env.json_Audio }}
|
|
|
|
|
|
|
|
- name: Выполнить ОтправитьДокумент
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram ОтправитьДокумент \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
2024-03-22 19:18:36 +02:00
|
|
|
--chat ${{ env.json_Telegram_ChatID }} \
|
2024-03-21 14:22:23 +02:00
|
|
|
--text "Тестовое сообщение" \
|
2024-03-21 14:11:30 +02:00
|
|
|
--path ${{ env.json_Document }}
|
|
|
|
|
2024-03-22 12:08:12 +02:00
|
|
|
- name: Выполнить ОтправитьМедиагруппу
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
2024-03-22 12:26:26 +02:00
|
|
|
echo " {
|
|
|
|
\"${{ env.json_Picture }}\" : \"photo\",
|
|
|
|
\"${{ env.json_Picture2 }}\" : \"photo\"
|
2024-03-22 12:08:12 +02:00
|
|
|
} " > mediagroup.json
|
|
|
|
|
|
|
|
./oint_bin telegram ОтправитьМедиагруппу \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
2024-03-22 19:18:36 +02:00
|
|
|
--chat ${{ env.json_Telegram_ChatID }} \
|
2024-03-22 12:08:12 +02:00
|
|
|
--text "Тестовое сообщение" \
|
|
|
|
--path mediagroup.json
|
2024-03-22 19:18:36 +02:00
|
|
|
|
|
|
|
- name: Выполнить ОтправитьМестоположение
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram ОтправитьМестоположение \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
|
|
|
--chat ${{ env.json_Telegram_ChatID }} \
|
|
|
|
--lat 48.87373649724122 \
|
|
|
|
--long "48.87373649724122"
|
|
|
|
|
|
|
|
- name: Выполнить ОтправитьКонтакт
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram ОтправитьКонтакт \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
|
|
|
--chat ${{ env.json_Telegram_ChatID }} \
|
|
|
|
--name Петр \
|
|
|
|
--surname Петров \
|
|
|
|
--phone +123456789
|
|
|
|
|
|
|
|
- name: Выполнить ОтправитьОпрос
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram ОтправитьОпрос \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
|
|
|
--chat ${{ env.json_Telegram_ChatID }} \
|
|
|
|
--question Да или нет? \
|
|
|
|
--options "['Да', 'Нет', 'Затрудняюсь ответить']" \
|
|
|
|
--anonymous true
|
|
|
|
|
|
|
|
- name: Выполнить ПереслатьСообщение
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram ПереслатьСообщение \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
|
|
|
--message ${{ env.json_Telegram_ChannelMessageID }} \
|
|
|
|
--to ${{ env.json_Telegram_ChatID }} \
|
|
|
|
--from ${{ env.json_Telegram_ChannelID }}
|
|
|
|
|
|
|
|
- name: Выполнить Бан
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram Бан \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
|
|
|
--user ${{ env.json_Telegram_ChatID }} \
|
|
|
|
--chat ${{ env.json_Telegram_ChannelID }}
|
|
|
|
|
|
|
|
- name: Выполнить Разбан
|
|
|
|
if: ${{ cancelled() }} == false
|
|
|
|
run: |
|
|
|
|
./oint_bin telegram Бан \
|
|
|
|
--token ${{ env.json_Telegram_Token }} \
|
|
|
|
--user ${{ env.json_Telegram_ChatID }} \
|
|
|
|
--chat ${{ env.json_Telegram_ChannelID }}
|
2024-03-22 12:08:12 +02:00
|
|
|
|
2024-03-20 21:12:42 +02:00
|
|
|
Clear-Cache:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [Testing-Telegram]
|
2024-03-21 14:27:26 +02:00
|
|
|
if: ${{ always() }}
|
2024-03-20 21:12:42 +02:00
|
|
|
steps:
|
|
|
|
- name: Очистка кэша
|
|
|
|
run: |
|
|
|
|
curl -L \
|
|
|
|
-X DELETE \
|
|
|
|
-H "Accept: application/vnd.github+json" \
|
|
|
|
-H "Authorization: Bearer ${{ secrets.TOKEN }}" \
|
|
|
|
-H "X-GitHub-Api-Version: 2022-11-28" \
|
2024-03-20 21:15:52 +02:00
|
|
|
"https://api.github.com/repos/Bayselonarrend/OpenIntegrations/actions/caches?key=test-data"
|
|
|
|
|