Continuous deployment difficulties with github actions and loading models into Github and Rasa X

Hey there, I am trying to use a CI/CD Pipeline. Training and testing my model seems to work fine but Upload Cross Validation Results (to Github), Upload model to Github and Upload Model to Rasa X make some Problems, because the actions seem to work, but the artifacts do not show up.

My Workflow-Description:

name: Continuous Integration Continuous Deployment
    on:
      push:
        branches:
        - 'master'
      pull_request:
        types: [opened, synchronize, reopened] 
env:
  DOMAIN:  ${{ secrets.DOMAIN }}
jobs:  
  build-model:
    name: train and test Model 
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - id: files
      uses: jitterbit/get-changed-files@v1
    - name: set_training
      if: |
          contains(  steps.files.outputs.all, 'data/' )
          || contains(  steps.files.outputs.all, 'config.yml' )
          || contains(  steps.files.outputs.all, 'domain.yml' )
      run: echo "RUN_TRAINING=true" >> $GITHUB_ENV
    - name: Set up Python 3.7
      if: env.RUN_TRAINING == 'true'
      uses: actions/setup-python@v1
      with:
        python-version: 3.7
    - name: Install dependencies
      if: env.RUN_TRAINING == 'true'
      run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install git+https://github.com/RasaHQ/rasa-nlu-examples 
    - name: Check stories are consistent
      if: env.RUN_TRAINING == 'true'
      run: |
        rasa data validate --max-history 5 
    - name: Train Model
      if: env.RUN_TRAINING == 'true'
      working-directory: ${{ github.workspace }}
      run: |
        rasa train
    - name: Run Through Test Stories
      if: env.RUN_TRAINING == 'true'
      run: |
        rasa test core --stories tests/test_stories.md --fail-on-prediction-errors
    - name: Cross-validate NLU model
      if: env.RUN_TRAINING == 'true' && github.event_name == 'pull_request'
      run: |
        rasa test nlu -f 2 --cross-validation
        python format_results.py
    - name: Upload Cross Validation Results
      if: env.RUN_TRAINING == 'true' && github.event_name == 'pull_request'
      uses: actions/upload-artifact@v2
      with:
        name: cross-validation-result
        path: results.md       
    - name: Upload model to Github
      if: env.RUN_TRAINING == 'true' && github.event_name == 'push' && (startsWith(github.event.ref, 'refs/tags') || github.ref == 'refs/heads/master')
      uses: actions/upload-artifact@master
      with:
        name: model
        path: models
    - name: Upload Model to Rasa X
      if: env.RUN_TRAINING == 'true'
      env:
        RASA_X_API_TOKEN: ${{ secrets.RASA_X_API_TOKEN }}
      working-directory: ${{ github.workspace }}
      run: |
        model_path=`ls models/*.tar.gz | head -n 1`
        curl -k -F "model=${model_path}" ${{ secrets.MODEL_UPLOAD_CALL }}

I do not understand why it says “finished uploading artifact model” at the end, because it is not in my repo afterwards. I do not get any error messages. Everything ist completed. Your help would be great!

Hi Jessica,

We have a new github action that does just what you are looking for. You’ll find the info here.

Here’s an example use of the actions (this one splits the model build and testing in separate jobs but this can be done in a single job):

jobs:
  lint-testing:
    name: Code Formatting Tests
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Set up Python 3.7
      uses: actions/setup-python@v1
      with:
        python-version: 3.7
    - name: Install dependencies
      run: |
        python -m pip install --upgrade "pip<20"
        pip install -r requirements-dev.txt
    - name: Code Formatting Tests
      working-directory: ${{ github.workspace }}
      run: |
        make lint

  type-testing:
    name: Type Tests
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Set up Python 3.7
      uses: actions/setup-python@v1
      with:
        python-version: 3.7
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install -r requirements-dev.txt
    - name: Type Checking
      working-directory: ${{ github.workspace }}
      run: |
        make types

  training:
    name: Train Model
    runs-on: ubuntu-latest
    needs: [lint-testing, type-testing]

    env:
      RASA_VERSION: 2.1.3-spacy-en
      RUN_TRAINING: false

    steps:
      - uses: actions/checkout@v1
      - id: files
        uses: jitterbit/get-changed-files@v1
      - name: Did Training Data Change
        if: |
            contains(  steps.files.outputs.all, 'data/' )
            || contains(  steps.files.outputs.all, 'config.yml' )
            || contains(  steps.files.outputs.all, 'domain.yml' )
        run: echo "RUN_TRAINING=true" >> $GITHUB_ENV
      - name: Rasa Train
        if: env.RUN_TRAINING == 'true'
        uses: RasaHQ/rasa-train-test-gha@main
        with:
          rasa_version: ${{ env.RASA_VERSION }}
          rasa_test: false
          data_validate: true
          github_token: ${{ secrets.GITHUB_TOKEN }}

  test-model:
    name: Test Model
    runs-on: ubuntu-latest
    needs: [training]

    env:
      RASA_VERSION: 2.1.3-spacy-en

    steps:
      - uses: actions/checkout@v1
      - name: Rasa Test
        if: ${{ env.RUN_TRAINING }} == 'true'
        uses: RasaHQ/rasa-train-test-gha@main
        with:
          rasa_version: ${{ env.RASA_VERSION }}
          rasa_train: false
          test_type: all
          data_validate: true
          cross_validation: true
          publish_summary: true
          github_token: ${{ secrets.GITHUB_TOKEN }}
      - name: Upload model
        if: ${{ env.RUN_TRAINING }} == 'true'
        uses: actions/upload-artifact@master
        with:
          name: model
          path: models/

I have the same code in my workflow but this pushes the model only as an artifact into the results of the workflow. It will not be pushed into the models-folder in master-branch. But currently my model-file is too large for Github, so it is not that necessary anymore.

We don’t recommend checking the models into the git repo. You should have a separate store for models.