Skip to content

LanguageCode

LanguageCode #111

Workflow file for this run

name: GitHub CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build-nugets:
name: 🚀 Pack ${{matrix.projectName}}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectName:
- LanguageIdentification.CLD2.Native
- LanguageIdentification.CLD2
- LanguageIdentification.CLD3.Native
- LanguageIdentification.CLD3
- LanguageIdentification.FastText.Native
- LanguageIdentification.FastText
- LanguageIdentification.Whatlang.Native
- LanguageIdentification.Whatlang
- LanguageCode
permissions:
contents: read
packages: write
env:
ROOT: ./src
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: 📂 Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
5.0.x
6.0.x
7.0.x
8.0.x
source-url: https://nuget.pkg.github.com/${{github.repository_owner}}/index.json
- name: 📂 Files
working-directory: ${{env.ROOT}}
run: ls -R
- name: 🚀 Pack ${{matrix.projectName}}
working-directory: ${{env.ROOT}}/${{matrix.projectName}}
run: dotnet pack -c Release -o out
- uses: actions/upload-artifact@v4
with:
name: build-${{matrix.projectName}}
path: ${{env.ROOT}}/${{matrix.projectName}}/out
retention-days: 1
overwrite: 'true'
compression-level: 0
test-nugets:
name: 🧪 Test ${{matrix.projectName}}
runs-on: ubuntu-latest
needs: build-nugets
permissions:
contents: read
packages: write
env:
ROOT: ./src
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: build-*
merge-multiple: true
path: ${{env.ROOT}}/local-nugets
- name: 📂 Files
working-directory: ${{env.ROOT}}
run: ls -R
- name: 📂 Build Docker Image
working-directory: ${{env.ROOT}}
run: |
docker build -f ./test.Dockerfile -t langunage-identification-test-runner:latest .
docker build -f ./test-ci.Dockerfile -t langunage-identification-test-runner-ci:latest .
- name: 🧪 Run Tests in Docker
working-directory: ${{env.ROOT}}
run: docker run --rm -v $(pwd):/src langunage-identification-test-runner-ci:latest
- name: 🧪 Run Test for LanguageCode
working-directory: ${{env.ROOT}}/LanguageCode.Tests
run: dotnet test -c CI
deploy-nugets:
name: 🚚 Push ${{matrix.projectName}}
runs-on: ubuntu-latest
needs: test-nugets
if: github.ref == 'refs/heads/master'
strategy:
fail-fast: false
matrix:
projectName:
- LanguageIdentification.CLD2.Native
- LanguageIdentification.CLD2
- LanguageIdentification.CLD3.Native
- LanguageIdentification.CLD3
- LanguageIdentification.FastText.Native
- LanguageIdentification.FastText
- LanguageIdentification.Whatlang.Native
- LanguageIdentification.Whatlang
- LanguageCode
permissions:
contents: read
packages: write
env:
ROOT: ./src
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MICROSOFT_NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_WRITE_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: build-${{matrix.projectName}}
path: ${{env.ROOT}}/${{matrix.projectName}}/out
- name: 📂 Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
5.0.x
6.0.x
7.0.x
8.0.x
source-url: https://nuget.pkg.github.com/${{github.repository_owner}}/index.json
- name: 📂 Files
working-directory: ${{env.ROOT}}
run: ls -R
- name: 🚚 Push ${{matrix.projectName}} to GitHub registry
working-directory: ${{env.ROOT}}/${{matrix.projectName}}
run: dotnet nuget push ./out/**/*.nupkg --skip-duplicate -k ${{env.NUGET_AUTH_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}}/index.json
- name: 🚚 Push ${{matrix.projectName}} to Microsoft registry
working-directory: ${{env.ROOT}}/${{matrix.projectName}}
run: dotnet nuget push ./out/**/*.nupkg --skip-duplicate -k ${{env.MICROSOFT_NUGET_AUTH_TOKEN}} --source https://api.nuget.org/v3/index.json
- uses: geekyeggo/delete-artifact@v5
with:
name: build-${{matrix.projectName}}