# This is a basic workflow that is manually triggered

name: GUIX Studio Demo Compile Test

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
  workflow_dispatch:  
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
 
# 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 "linux_job"
  run_tests:
    permissions:
      contents: read
      issues: read
      checks: write
      pull-requests: write
      
    # The type of runner that the job will run on
    runs-on: windows-2019

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
    - name: Check out the repository
      uses: actions/checkout@v4
      with:
        submodules: true
    
    - name: Build
      run: scripts\build_guix.cmd
      
    - name: Test
      run: scripts\test_studio_demo_compile.cmd

    - name: Publish Test Results
      uses: EnricoMi/publish-unit-test-result-action/composite@v2
      if: always()
      with:
        check_name: Test Results GUIX Studio Demo Compile
        files: |
          test\guix_studio_test\test_demo\demo_compile\*.xml
    
    - name: Upload Test Results
      if: success() || failure()
      uses: actions/upload-artifact@v3.1.3
      with:
        name: test_reports
        path: |
          test\guix_studio_test\test_demo\demo_compile\*.xml
          test\guix_studio_test\test_demo\demo_compile\Testing\**\*.xml
        
