.github/workflows/test-providers.yml
---
name: Test providers
on: # yamllint disable-line rule:truthy
pull_request:
paths:
- .github/workflows/test-providers.yml
- dist/**
- src/**
- action.yml
push:
branches:
- main
defaults:
run:
shell: sh
jobs:
test-providers:
name: ${{ matrix.provider }}
timeout-minutes: 5
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- provider: "deepl"
lang: "en-uk"
source: "Love"
expected: "Любов"
api_key: "DEEPL_API_KEY" # pragma: allowlist secret
- provider: "google"
lang: "en-hr"
source: "Love"
expected: "Ljubav"
api_key: "N_A" # pragma: allowlist secret
- provider: "linguatools"
lang: "en-de"
source: "Love"
expected: "Love"
api_key: "N_A" # pragma: allowlist secret
- provider: "mymemory"
lang: "en|sw"
source: "Love"
expected: "Upendo"
api_key: "N_A" # pragma: allowlist secret
- provider: "mymemory"
lang: "en|pt"
source: "Love"
expected: "Amor"
api_key: "MYMEMORY_API_KEY" # pragma: allowlist secret
- provider: "funtranslations"
lang: "klingon"
source: "Love"
expected: "Parmaq"
api_key: "N_A" # pragma: allowlist secret
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: Translate (${{ matrix.provider }}, ${{ matrix.lang }})
uses: ./
id: result
with:
provider: ${{ matrix.provider }}
lang: ${{ matrix.lang }}
source: ${{ matrix.source }}
api_key: "${{ secrets[matrix.api_key] }}"
- name: Validate ${{ matrix.provider }} translation result
run: |
echo "'${{ matrix.source }}' has been translated to '${{ steps.result.outputs.text }}'"
[ "${{ steps.result.outputs.text }}" = "${{ matrix.expected }}" ] || exit 1;