Issue#4 CI Jobs to run tests on schedule and on Pull Requests

This commit is contained in:
Gergely Hegedus 2022-04-21 15:20:09 +03:00
parent 1a75c3619c
commit fb5f07d54a
3 changed files with 68 additions and 2 deletions

33
.github/workflows/pull-request-jobs.yml vendored Normal file
View file

@ -0,0 +1,33 @@
name: Verify Pull request is fine
on:
pull_request:
branches:
- develop
env:
GITHUB_USERNAME: "fknives"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
run-tests:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Run Unit Tests
run: ./gradlew :app:testDebugUnitTest --tests "org.fnives.tiktokdownloader.*"
- name: Upload Test Results
uses: actions/upload-artifact@v2
if: always()
with:
name: Test Results
path: ./**/build/reports/tests/**/index.html
retention-days: 1

32
.github/workflows/up-to-date-jobs.yml vendored Normal file
View file

@ -0,0 +1,32 @@
name: Verify Download Method still works
on:
schedule:
- cron: '0 20 21 * *'
env:
GITHUB_USERNAME: "fknives"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
run-up-to-date-tests:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Run Up-To-Date Tests
run: ./gradlew :app:testDebugUnitTest --tests "org.fnives.uptodate.*"
- name: Upload Test Results
uses: actions/upload-artifact@v2
if: always()
with:
name: Test Results
path: ./**/build/reports/tests/**/index.html
retention-days: 1

View file

@ -1,8 +1,9 @@
package org.fnives.tiktokdownloader.data.network
package org.fnives.uptodate
import kotlinx.coroutines.runBlocking
import org.apache.commons.io.FileUtils
import org.fnives.tiktokdownloader.data.model.VideoInPending
import org.fnives.tiktokdownloader.data.network.TikTokDownloadRemoteSource
import org.fnives.tiktokdownloader.di.module.NetworkModule
import org.fnives.tiktokdownloader.helper.getResourceFile
import org.junit.jupiter.api.Assertions
@ -28,7 +29,7 @@ class TikTokDownloadRemoteSourceUpToDateTest {
sut = NetworkModule(1).tikTokDownloadRemoteSource
}
@Disabled("Can trigger captcha, so only run it separately")
//@Disabled("Can trigger captcha, so only run it separately")
@Timeout(value = 120)
@Test
fun GIVEN_actualVideo_WHEN_downloading_THEN_the_file_matching_with_the_previously_loaded_video() {