.github/workflows/run_tests_in_docker.yml
author Edouard Tisserant <edouard.tisserant@gmail.com>
Tue, 20 Aug 2024 01:13:14 +0200
changeset 3973 42730c1cb879
parent 3958 d5fb90fd2a79
child 4030 45532de22b75
permissions -rw-r--r--
IDE: fix completion

uses ctrl key on Mac
update internal variable list before listing them
avoid exception if empty list
apply selection when pressing return or enter
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
3939
b73d6668eba3 Update revisions used in tests running on GitHub.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3927
diff changeset
    21
          ref: d3196244bf50b2d6d512a0240e10dfa75edbeb7b
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
3958
d5fb90fd2a79 Tests: add erpc source to GitHub tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3939
diff changeset
    27
          # v1.3.7
d5fb90fd2a79 Tests: add erpc source to GitHub tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3939
diff changeset
    28
          ref: b8ac9e77f703e6ba5c012b886a8821037503daa6
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
    29
          path: open62541
3560
f0ed67b01a9d GitHub CI: my bad. m( Was just wrong version
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3559
diff changeset
    30
          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
    31
3927
228d3b758f19 Modbus: fix test: add missing filles and add Modbus source+build in GH CI
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3841
diff changeset
    32
    - uses: actions/checkout@v3
228d3b758f19 Modbus: fix test: add missing filles and add Modbus source+build in GH CI
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3841
diff changeset
    33
      with:
228d3b758f19 Modbus: fix test: add missing filles and add Modbus source+build in GH CI
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3841
diff changeset
    34
          repository: beremiz/Modbus
228d3b758f19 Modbus: fix test: add missing filles and add Modbus source+build in GH CI
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3841
diff changeset
    35
          ref: 4d7d67a8e911d744165709c20a254b5cb924ec71
228d3b758f19 Modbus: fix test: add missing filles and add Modbus source+build in GH CI
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3841
diff changeset
    36
          path: Modbus
228d3b758f19 Modbus: fix test: add missing filles and add Modbus source+build in GH CI
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3841
diff changeset
    37
3958
d5fb90fd2a79 Tests: add erpc source to GitHub tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3939
diff changeset
    38
    - uses: actions/checkout@v3
d5fb90fd2a79 Tests: add erpc source to GitHub tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3939
diff changeset
    39
      with:
d5fb90fd2a79 Tests: add erpc source to GitHub tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3939
diff changeset
    40
          repository: EmbeddedRPC/erpc
d5fb90fd2a79 Tests: add erpc source to GitHub tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3939
diff changeset
    41
          # v1.12.0
d5fb90fd2a79 Tests: add erpc source to GitHub tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3939
diff changeset
    42
          ref: 85d3dd8656ccce4c2d929a69484fb8d88ec6c6c3
d5fb90fd2a79 Tests: add erpc source to GitHub tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3939
diff changeset
    43
          path: erpc
d5fb90fd2a79 Tests: add erpc source to GitHub tests
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3939
diff changeset
    44
              
3828
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    45
    - 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
    46
      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
    47
      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
    48
      env:
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    49
        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
    50
      with:
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    51
        path: /tmp/latest.tar
3841
02fa0f8484d7 Tests: align on requirements.txt
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3836
diff changeset
    52
        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
    53
3828
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    54
    - 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
    55
      name: Create docker image
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    56
      run: |
3693
4058140a8757 Tests: cleanup and tidy docker definitions and scripts
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3632
diff changeset
    57
        cd beremiz/tests/tools/Docker
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    58
        ./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
    59
        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
    60
3831
2596dabeea04 Github CI: do not save docker image if just restored from cache
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3829
diff changeset
    61
    - 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
    62
      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
    63
      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
    64
      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
    65
      with:
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    66
        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
    67
        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
    68
57545857bdce Github CI: update open62541 version, try avoid useles doker image rebuild
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3827
diff changeset
    69
    - 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
    70
      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
    71
      run: |
3460
d3c95ae44750 Tests: fix docker image export for GitHub Action caching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3459
diff changeset
    72
        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
    73
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    74
    - name: Create docker container
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    75
      run: |
3693
4058140a8757 Tests: cleanup and tidy docker definitions and scripts
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3632
diff changeset
    76
        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
    77
        ./create_docker_container.sh ${{ github.workspace }}/test
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    78
        
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
    79
    - 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
    80
      run: |
3693
4058140a8757 Tests: cleanup and tidy docker definitions and scripts
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3632
diff changeset
    81
        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
    82
        ./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
    83
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    84
    - 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
    85
      uses: actions/upload-artifact@v3
3533
49e7d2247d46 Github CI: upload artifact (reports) when failing
etisserant <edouard.tisserant@gmail.com>
parents: 3530
diff changeset
    86
      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
    87
      with:
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    88
        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
    89
        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
    90
        retention-days: 5