.github/workflows/run_tests_in_docker.yml
author Edouard Tisserant <edouard@beremiz.fr>
Fri, 23 Feb 2024 11:54:51 +0100
changeset 3901 b8b3573475e7
parent 3841 02fa0f8484d7
child 3927 228d3b758f19
permissions -rw-r--r--
Fix SVGHMI build exception on windows: return bytes for inkscape path in docsvg.
3836
9b4e94608036 Add testing status badge
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3831
diff changeset
     1
name: CI Automated testing
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
on:
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     4
  push:
3827
50e79436f9b4 Update run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents: 3700
diff changeset
     5
    branches: [ python3 ]
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     6
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
jobs:
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     9
  build:
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    10
3700
302492568cf4 Backed out changeset ddadbdf20e70, no effect on current problem.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3699
diff changeset
    11
    runs-on: ubuntu-latest
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    12
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
    steps:
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    14
    - uses: actions/checkout@v3
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    15
      with:
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    16
          path: beremiz
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    17
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    18
    - uses: actions/checkout@v3
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    19
      with:
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    20
          repository: beremiz/matiec
3829
18aae6235e76 Github CI: update matiec revision
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3828
diff changeset
    21
          ref: e5be6a1f036d21cd7b5ee75ef352783a7cfcc1a7
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    22
          path: matiec
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    23
3549
0af7b6a96c53 CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3533
diff changeset
    24
    - uses: actions/checkout@v3
0af7b6a96c53 CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3533
diff changeset
    25
      with:
0af7b6a96c53 CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3533
diff changeset
    26
          repository: open62541/open62541
3828
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    27
          ref: v1.3.6
3549
0af7b6a96c53 CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3533
diff changeset
    28
          path: open62541
3560
f0ed67b01a9d GitHub CI: my bad. m( Was just wrong version
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3559
diff changeset
    29
          submodules: recursive
3549
0af7b6a96c53 CLI: fix fake_wx for OPC-UA in CLI, match with test and requirements
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3533
diff changeset
    30
3828
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    31
    - name: Restore cached docker image
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    32
      id: cache-docker-restore
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    33
      uses: actions/cache/restore@v3
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    34
      env:
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    35
        cache-name: cache-docker
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    36
      with:
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    37
        path: /tmp/latest.tar
3841
02fa0f8484d7 Tests: align on requirements.txt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3836
diff changeset
    38
        key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('beremiz/tests/tools/Docker', 'beremiz/requirements.txt') }}
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    39
3828
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    40
    - if: ${{ steps.cache-docker-restore.outputs.cache-hit == false }}
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    41
      name: Create docker image
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    42
      run: |
3693
4058140a8757 Tests: cleanup and tidy docker definitions and scripts
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3632
diff changeset
    43
        cd beremiz/tests/tools/Docker
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    44
        ./build_docker_image.sh
3460
d3c95ae44750 Tests: fix docker image export for GitHub Action caching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3459
diff changeset
    45
        docker image save --output="/tmp/latest.tar" beremiz_sikuli
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    46
3831
2596dabeea04 Github CI: do not save docker image if just restored from cache
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3829
diff changeset
    47
    - if: ${{ steps.cache-docker-restore.outputs.cache-hit == false }}
2596dabeea04 Github CI: do not save docker image if just restored from cache
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3829
diff changeset
    48
      name: Save docker image in cache
3828
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    49
      id: cache-docker-save
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    50
      uses: actions/cache/save@v3
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    51
      with:
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    52
        path: /tmp/latest.tar
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    53
        key: ${{ steps.cache-docker-restore.outputs.cache-primary-key }}
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    54
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    55
    - if: ${{ steps.cache-docker-restore.outputs.cache-hit != false }}
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    56
      name: Re-use docker image
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    57
      run: |
3460
d3c95ae44750 Tests: fix docker image export for GitHub Action caching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3459
diff changeset
    58
        docker image load --input="/tmp/latest.tar" 
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    59
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    60
    - name: Create docker container
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    61
      run: |
3693
4058140a8757 Tests: cleanup and tidy docker definitions and scripts
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3632
diff changeset
    62
        cd beremiz/tests/tools/Docker
3461
fb8c2fa0d8f0 Tests: give test directory when creating container, not when running test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3460
diff changeset
    63
        ./create_docker_container.sh ${{ github.workspace }}/test
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    64
        
3463
f85b448ca2c6 Tests: re-enable running test in github action, now that docker image should be cached.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3462
diff changeset
    65
    - name: Run tests in docker
f85b448ca2c6 Tests: re-enable running test in github action, now that docker image should be cached.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3462
diff changeset
    66
      run: |
3693
4058140a8757 Tests: cleanup and tidy docker definitions and scripts
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3632
diff changeset
    67
        cd beremiz/tests/tools/Docker
3530
ec3672b7532b Github CI: use new name for test launching script
etisserant <edouard.tisserant@gmail.com>
parents: 3465
diff changeset
    68
        ./do_test_in_docker.sh
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    69
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    70
    - name: Upload test resuts artifact
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    71
      uses: actions/upload-artifact@v3
3533
49e7d2247d46 Github CI: upload artifact (reports) when failing
etisserant <edouard.tisserant@gmail.com>
parents: 3530
diff changeset
    72
      if: failure()
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    73
      with:
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    74
        name: test_results
3465
2f5b5c14a650 Tests: No need to archive test results before uploading them as action artifacts.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3464
diff changeset
    75
        path: ${{ github.workspace }}/test
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    76
        retention-days: 5