add target_loss #258
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test and Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - dev | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Python 3 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: "pip" | |
| - name: Install R | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| r-version: "latest" | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| python -m pip install .[dev,r] | |
| - name: Set R environment variables | |
| run: | | |
| echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" | |
| R_LIB_PATH=$(python -m rpy2.situation LD_LIBRARY_PATH | tail -n 1 | xargs) | |
| echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$R_LIB_PATH" >> $GITHUB_ENV | |
| - name: test imports | |
| run: | | |
| python -c " | |
| from morai.experience import experience, tables | |
| from morai.utils import helpers | |
| " | |
| - name: Lint | |
| run: ruff check morai/ | |
| continue-on-error: true | |
| - name: Type check | |
| run: mypy morai/ | |
| continue-on-error: true | |
| - name: Run tests with pytest and upload coverage | |
| run: pytest --cov=morai --cov-report=xml | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v5 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| build_and_push_docker: | |
| if: github.ref == 'refs/heads/main' | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: dmbymdt/morai:latest |