Skip to content

feat: externalize packages for i18nify-go #709

feat: externalize packages for i18nify-go

feat: externalize packages for i18nify-go #709

Workflow file for this run

name: (i18nify-go) Unit Tests
on:
pull_request:
jobs:
# JOB to run change detection
check-if-i18nify-go:
runs-on: ubuntu-latest
outputs:
modified: ${{ steps.filter.outputs.src }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- 'packages/i18nify-go/**'
- 'i18nify-data/go/**'
- 'i18nify-data/country/subdivisions/**'
run-test:
name: Run Unit Tests
runs-on: ubuntu-latest
needs: check-if-i18nify-go
if: |
needs.check-if-i18nify-go.outputs.modified == 'true' && !(github.head_ref == 'changeset-release/master' && github.actor == 'rzpcibot')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- name: Setup local replace directives
run: |
cd $GITHUB_WORKSPACE/packages/i18nify-go
# Check if generated package exists locally and add replace directive
# This allows tests to run even before the package is pushed to GitHub
GENERATED_PKG="../../i18nify-data/go/country/subdivisions"
if [ -d "$GENERATED_PKG" ] && [ -f "$GENERATED_PKG/go.mod" ]; then
echo "Adding replace directive for local generated package..."
go mod edit -replace "github.com/razorpay/i18nify/i18nify-data/go/country/subdivisions=${GENERATED_PKG}"
go mod tidy
fi
- name: Run Unit Tests
run: |
cd $GITHUB_WORKSPACE/packages/i18nify-go
go test -v github.com/razorpay/i18nify/packages/i18nify-go/modules/...