From ba30f10b7c8336a142a162a179f9d3aa926aeb7e Mon Sep 17 00:00:00 2001 From: Ruslan Ibragimov Date: Mon, 23 Oct 2023 10:50:47 +0300 Subject: [PATCH] Separate test and build workflows --- .github/workflows/build.yml | 16 ++++++---------- .github/workflows/codeql.yml | 27 +++++++-------------------- .github/workflows/test.yml | 24 ++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecd73e7..6f1dd4b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,12 +1,13 @@ -name: "Build" +name: "Build Kotbot Docker" + on: - push - pull_request + jobs: build: - name: "Build backend" + name: "Build Application" runs-on: ubuntu-latest - concurrency: telegram-bot-tests-single steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v3 @@ -14,19 +15,14 @@ jobs: java-version: "17" distribution: "liberica" - uses: gradle/gradle-build-action@v2 - - run: ./gradlew check distTar - env: - KOTBOT_TOKEN: ${{ secrets.KOTBOT_TOKEN }} - KOTBOT_QA_USER_ID: ${{ secrets.KOTBOT_QA_USER_ID }} - KOTBOT_QA_GROUP_ID: ${{ secrets.KOTBOT_QA_GROUP_ID }} - KOTBOT_QA_CHANNEL_ID: ${{ secrets.KOTBOT_QA_CHANNEL_ID }} - KOTBOT_QA_PUBLIC_CHANNEL_ID: ${{ secrets.KOTBOT_QA_PUBLIC_CHANNEL_ID }} + - run: ./gradlew distTar - uses: actions/upload-artifact@v3 with: name: "Kotlin Application" path: "tgkotbot/build/distributions/kotbot.tar" retention-days: 1 build-and-push-image: + name: "Build Docker Image" if: ${{ github.ref == 'refs/heads/main' }} runs-on: ubuntu-latest needs: build diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index c8ea23e..fe91aaf 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,28 +1,16 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# name: "CodeQL" on: push: branches: [ "main" ] pull_request: - # The branches below must be a subset of the branches above branches: [ "main" ] schedule: - cron: '30 9 * * 2' jobs: analyze: - name: Analyze + name: "Analyze Kotlin Code" runs-on: 'ubuntu-latest' timeout-minutes: 120 permissions: @@ -39,17 +27,16 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - run: | - echo "Run, Build Application using script" - ./gradlew build -x test - + - uses: actions/setup-java@v3 + with: + java-version: "17" + distribution: "liberica" + - uses: gradle/gradle-build-action@v2 + - run: ./gradlew build -x test - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ee099b0 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,24 @@ +name: "Test Telegram API" + +on: + workflow_dispatch + +jobs: + build: + name: "Test Telegram API" + runs-on: ubuntu-latest + concurrency: telegram-api-tests-single + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + java-version: "17" + distribution: "liberica" + - uses: gradle/gradle-build-action@v2 + - run: ./gradlew check + env: + KOTBOT_TOKEN: ${{ secrets.KOTBOT_TOKEN }} + KOTBOT_QA_USER_ID: ${{ secrets.KOTBOT_QA_USER_ID }} + KOTBOT_QA_GROUP_ID: ${{ secrets.KOTBOT_QA_GROUP_ID }} + KOTBOT_QA_CHANNEL_ID: ${{ secrets.KOTBOT_QA_CHANNEL_ID }} + KOTBOT_QA_PUBLIC_CHANNEL_ID: ${{ secrets.KOTBOT_QA_PUBLIC_CHANNEL_ID }}