| 
 | 1 | +# Inspired by https://github.com/utopia-rise/fmod-gdextension/blob/godot-3.x/demo/run_tests.sh  | 
 | 2 | + | 
 | 3 | +name: test  | 
 | 4 | +description: "Runs the tests via GUT CLI"  | 
 | 5 | + | 
 | 6 | +inputs:  | 
 | 7 | +  gut-download-path:  | 
 | 8 | +    required: true  | 
 | 9 | +    default: ~/gut_download  | 
 | 10 | +  gut-addons-path:  | 
 | 11 | +    required: true  | 
 | 12 | +    default: ${{ github.workspace }}/test/addons/gut  | 
 | 13 | +  godot-test-project:  | 
 | 14 | +    required: true  | 
 | 15 | +    default: ${{ github.workspace }}/test  | 
 | 16 | + | 
 | 17 | +runs:  | 
 | 18 | +  using: composite  | 
 | 19 | + | 
 | 20 | +  steps:  | 
 | 21 | + | 
 | 22 | +    - name: "Set Cache Name"  | 
 | 23 | +      shell: bash  | 
 | 24 | +      run: |  | 
 | 25 | +        echo "CACHE_NAME_GUT=GUT_v7.4.1" >> "$GITHUB_ENV"  | 
 | 26 | +
  | 
 | 27 | +    - name: "GUT Cache Restore"  | 
 | 28 | +      uses: actions/cache/restore@v3  | 
 | 29 | +      id: gut-restore-cache  | 
 | 30 | +      with:  | 
 | 31 | +        path: ${{ inputs.gut-download-path }}  | 
 | 32 | +        key: ${{ runner.os }}-${{ env.CACHE_NAME_GUT }}  | 
 | 33 | + | 
 | 34 | +    - name: "Download GUT"  | 
 | 35 | +      if: steps.gut-restore-cache.outputs.cache-hit != 'true'  | 
 | 36 | +      continue-on-error: false  | 
 | 37 | +      shell: bash  | 
 | 38 | +      run: |  | 
 | 39 | +        mkdir -p ${{ inputs.gut-download-path }}  | 
 | 40 | +        chmod 770 ${{ inputs.gut-download-path }}  | 
 | 41 | +
  | 
 | 42 | +        wget https://github.com/bitwes/Gut/archive/refs/tags/v7.4.1.zip -P ${{ inputs.gut-download-path }}  | 
 | 43 | +        unzip ${{ inputs.gut-download-path }}/v7.4.1.zip -d ${{ inputs.gut-download-path }}/unzip  | 
 | 44 | +
  | 
 | 45 | +    - name: "GUT Cache Save"  | 
 | 46 | +      if: steps.gut-restore-cache.outputs.cache-hit != 'true'  | 
 | 47 | +      uses: actions/cache/save@v3  | 
 | 48 | +      with:  | 
 | 49 | +        path: ${{ inputs.gut-download-path }}  | 
 | 50 | +        key: ${{ steps.gut-restore-cache.outputs.cache-primary-key }}  | 
 | 51 | + | 
 | 52 | +    - name: "Create addons Directory"  | 
 | 53 | +      if: ${{ !cancelled() }}  | 
 | 54 | +      shell: bash  | 
 | 55 | +      run: mkdir -p ${{ github.workspace }}/test/addons  | 
 | 56 | + | 
 | 57 | +    - name: "⚔ Link GUT"  | 
 | 58 | +      if: ${{ !cancelled() }}  | 
 | 59 | +      shell: bash  | 
 | 60 | +      run: ln -s ${{ inputs.gut-download-path }}/unzip/Gut-7.4.1/addons/gut ${{ github.workspace }}/test/addons/gut  | 
 | 61 | + | 
 | 62 | +    - name: "⚔ Link Mod Loader"  | 
 | 63 | +      if: ${{ !cancelled() }}  | 
 | 64 | +      shell: bash  | 
 | 65 | +      run: ln -s ${{ github.workspace }}/addons/mod_loader ${{ github.workspace }}/test/addons/mod_loader  | 
 | 66 | + | 
 | 67 | +    - name: "⚔ Link JSON_Schema_Validator"  | 
 | 68 | +      if: ${{ !cancelled() }}  | 
 | 69 | +      shell: bash  | 
 | 70 | +      run: ln -s ${{ github.workspace }}/addons/JSON_Schema_Validator ${{ github.workspace }}/test/addons/JSON_Schema_Validator  | 
 | 71 | + | 
 | 72 | +    - name: "Run Tests"  | 
 | 73 | +      if: ${{ runner.OS == 'Linux'}} && ${{ !cancelled() }}  | 
 | 74 | +      env:  | 
 | 75 | +        TEST_PROJECT: ${{ inputs.godot-test-project }}  | 
 | 76 | +      shell: bash  | 
 | 77 | +      run: |  | 
 | 78 | +        cd "${TEST_PROJECT}"  | 
 | 79 | +        chmod +x run_tests.sh  | 
 | 80 | +        ./run_tests.sh "$HOME/godot-linux/godot"  | 
0 commit comments