[CODEGEN-1834] Support resource bundle for custom model version #966
This file contains 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
# This is a basic workflow to help you get started with Actions | |
name: Workflow CI/CD | |
# Controls when the workflow will run | |
on: | |
pull_request: | |
branches: [ master ] | |
types: [ opened, synchronize, reopened, edited ] | |
push: | |
branches: [ master ] | |
issue_comment: | |
types: [ created, edited ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
env: | |
LOGLEVEL: debug | |
DATAROBOT_API_TOKEN: ${{ secrets.DATAROBOT_API_TOKEN }} # Required by the functional tests | |
DATAROBOT_WEBSERVER: ${{ secrets.DATAROBOT_WEBSERVER }} # Required by the functional tests | |
INSPECT_CONTEXT: false | |
OUT_DIR: output-context/${{ github.event_name }} | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
validate-code-style: | |
# Run this job on any action of a PR, but skip the job upon merge to master | |
# if: github.event.pull_request.merged != true | |
if: | | |
github.event.comment.body == null || | |
(github.event.issue.pull_request && contains(github.event.comment.body, '$FUNCTIONAL_TESTS=')) | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Install Requirements | |
run: pip install -r ${{ github.workspace }}/tests/requirements.txt | |
- name: Check source code format (pycodestyle + black) | |
run: make lint | |
# Print out context information | |
- name: Inspect context | |
if: ${{ env.INSPECT_CONTEXT == 'true' }} | |
run: | | |
mkdir -p $OUT_DIR | |
echo Save github context vital information | |
echo "github.event_name: ${{ github.event_name }}" >> $OUT_DIR/github_context.txt | |
echo "github.event.pull_request.merged: ${{ github.event.pull_request.merged }}" >> $OUT_DIR/github_context.txt | |
echo "" >> $OUT_DIR/github_context.txt | |
echo "github.sha: ${{ github.sha }}" >> $OUT_DIR/github_context.txt | |
echo "github.pull_request.head.sha: ${{ github.pull_request.head.sha }}" >> $OUT_DIR/github_context.txt | |
echo "github.event.after: ${{ github.event.after }}" >> $OUT_DIR/github_context.txt | |
echo "github.event.before: ${{ github.event.before }}" >> $OUT_DIR/github_context.txt | |
echo "github.event.pull_request.head.sha: ${{ github.event.pull_request.head.sha }}" >> $OUT_DIR/github_context.txt | |
echo "github.event.pull_request.base.sha: ${{ github.event.pull_request.base.sha }}" >> $OUT_DIR/github_context.txt | |
echo "" >> $OUT_DIR/github_context.txt | |
echo "github.ref: ${{ github.ref }}" >> $OUT_DIR/github_context.txt | |
echo "github.ref_name: ${{ github.ref_name }}" >> $OUT_DIR/github_context.txt | |
echo "github.head_ref: ${{ github.head_ref }}" >> $OUT_DIR/github_context.txt | |
echo "github.base_ref: ${{ github.base_ref }}" >> $OUT_DIR/github_context.txt | |
echo "" >> $OUT_DIR/github_context.txt | |
echo "github.repository: ${{ github.repository }}" >> $OUT_DIR/github_context.txt | |
echo "github.workspace: ${{ github.workspace }}" >> $OUT_DIR/github_context.txt | |
echo "" >> $OUT_DIR/github_context.txt | |
echo "Comment:" >> $OUT_DIR/github_context.txt | |
echo "github.event.comment.body: ${{ github.event.comment.body }}" >> $OUT_DIR/github_context.txt | |
echo "github.event.comment: ${{ toJson(github.event.comment) }}" >> $OUT_DIR/github_context.txt | |
echo "" >> $OUT_DIR/github_context.txt | |
echo "toJson(github) - the whole GitHub context:" >> $OUT_DIR/github_context.txt | |
echo "${{ toJson(github) }}" >> $OUT_DIR/github_context.txt | |
echo "" >> $OUT_DIR/github_context.txt | |
- uses: actions/upload-artifact@v3 | |
if: ${{ env.INSPECT_CONTEXT == 'true' }} | |
with: | |
name: Context info artifact | |
path: output-context | |
run-unit-tests: | |
# Run this job on any action of a PR, but skip the job upon merge to master | |
if: | | |
github.event.pull_request.merged != true && | |
( | |
github.event.comment.body == null || | |
(github.event.issue.pull_request && contains(github.event.comment.body, '$FUNCTIONAL_TESTS=')) | |
) | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Install Requirements | |
run: pip install -r ${{ github.workspace }}/tests/requirements.txt | |
- name: Run unit-tests | |
run: make test | |
run-functional-test: | |
if: | | |
github.event.comment.body == null || | |
(github.event.issue.pull_request && contains(github.event.comment.body, '$FUNCTIONAL_TESTS=')) | |
needs: [run-unit-tests, validate-code-style] | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Check run state for functional tests | |
id: functional-tests-state | |
run: | | |
# Read the pull request body | |
body=$(cat <<"EOF" | |
${{github.event.pull_request.body}} | |
EOF | |
) | |
# Look for '$FUNCTIONAL_TESTS' in the body and add it to the 'TESTS_KEY' output | |
if [ ! -z "${{ github.event.comment.body }}" ]; then | |
functional_tests=$( \ | |
grep -o '$FUNCTIONAL_TESTS=[a-zA-Z0-9:/\._]\+' <<< '${{github.event.comment.body}}' \ | |
) | |
if [ ! -z "${functional_tests}" ]; then | |
echo "TESTS_KEY=${functional_tests:1}" >> $GITHUB_OUTPUT | |
fi | |
fi | |
# Determine the functional tests state | |
if grep '.*\- \[\s*x\s*\] Skip functional tests.*' <<< "${body}" > /dev/null; then | |
echo "The user decided to skip the functional tests." | |
echo "FUNCTIONAL_TESTS_RUN_STATE=skip" >> $GITHUB_OUTPUT | |
elif grep '.*\- \[\s*x\s*\] Run all functional tests.*' <<< "${body}" > /dev/null; then | |
echo "Run all functional tests." | |
echo "FUNCTIONAL_TESTS_RUN_STATE=all" >> $GITHUB_OUTPUT | |
else | |
echo "Run a basic functional test." | |
echo "FUNCTIONAL_TESTS_RUN_STATE=basic" >> $GITHUB_OUTPUT | |
fi | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
if: ${{ steps.functional-tests-state.outputs.FUNCTIONAL_TESTS_RUN_STATE != 'skip' }} | |
- name: Install Requirements | |
run: pip install -r ${{ github.workspace }}/tests/requirements.txt | |
if: ${{ steps.functional-tests-state.outputs.FUNCTIONAL_TESTS_RUN_STATE != 'skip' }} | |
- name: Run functional test(s) | |
if: ${{ steps.functional-tests-state.outputs.FUNCTIONAL_TESTS_RUN_STATE != 'skip' }} | |
run: | | |
if ${{ steps.functional-tests-state.outputs.FUNCTIONAL_TESTS_RUN_STATE == 'all' }}; then | |
${{ steps.functional-tests-state.outputs.TESTS_KEY }} make test-functional | |
else | |
${{ steps.functional-tests-state.outputs.TESTS_KEY }} make test-functional-basic | |
fi |