From feae030a6a92275c8a51408d07b262e076a8e889 Mon Sep 17 00:00:00 2001 From: Juan Castaneda Date: Tue, 12 Dec 2023 23:17:39 +0100 Subject: [PATCH] Added tests and workflow barch to readme file --- .github/workflows/ci.yaml | 6 +++--- Makefile | 4 ++++ README.md | 2 ++ .../java/io/github/castmart/jcountry/JCountryTest.java | 9 +++++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3bf7e46..ef0af0f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,7 +2,7 @@ name: CI run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 on: [push] jobs: - Explore-GitHub-Actions: + Run-Library-Tests: runs-on: ubuntu-latest steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." @@ -12,7 +12,7 @@ jobs: uses: actions/checkout@v4 - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository + - name: Execute tests run: | - ls ${{ github.workspace }} + make test - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/Makefile b/Makefile index 8bea4e1..ea312b2 100644 --- a/Makefile +++ b/Makefile @@ -43,3 +43,7 @@ publish-to-ossrh: GPG_SIGNING_KEY=${GPG_SIGNING_KEY} \ JCOUNTRY_VERSION=${version} \ ./gradlew publish + +.PHONY: test +test: + ./gradlew test diff --git a/README.md b/README.md index c344a79..652f867 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![CI](https://github.com/castmart/jcountry/actions/workflows/ci.yaml/badge.svg)](https://github.com/castmart/jcountry/actions/workflows/ci.yaml) + # JCountry This project tries to replicate the same functionality as [pycountry](https://github.com/flyingcircusio/pycountry) by wrapping iso files and provide a programatic interface. diff --git a/lib/src/test/java/io/github/castmart/jcountry/JCountryTest.java b/lib/src/test/java/io/github/castmart/jcountry/JCountryTest.java index 3706e1c..a0312f1 100644 --- a/lib/src/test/java/io/github/castmart/jcountry/JCountryTest.java +++ b/lib/src/test/java/io/github/castmart/jcountry/JCountryTest.java @@ -59,6 +59,10 @@ void testJCountryReadsTranslations() { languages.forEach( it -> { Optional bundle = countryDB.getCountriesTranslations(new Locale(it)); + if (bundle.isEmpty()) + System.out.println("Empty bundle for "+it); + else + System.out.println("Processing "+it); assertTrue(!bundle.isEmpty()); }); } @@ -114,6 +118,10 @@ void testJCountryLanguagesReadsTranslations() { languages.forEach( it -> { Optional bundle = languageDB.getLanguagesTranslations(new Locale(it)); + if (bundle.isEmpty()) + System.out.println("Empty bundle for "+it); + else + System.out.println("Processing "+it); assertTrue(!bundle.isEmpty(), it + " translation"); }); } @@ -121,6 +129,7 @@ void testJCountryLanguagesReadsTranslations() { @Test void getTranslatedLanguageName() { LanguageDB languageDB = new LanguageDBImpl(true); + JCountry.getInstance().getLanguageDB(); var dbByAlpha2 = languageDB.getLanguagesMapByAlpha2(); Optional bundle = languageDB.getLanguagesTranslations(Locale.GERMAN);