.github/workflows/run_tests_in_docker.yml
author Edouard Tisserant <edouard.tisserant@gmail.com>
Mon, 04 Jul 2022 08:35:47 +0200
branchwxPython4
changeset 3527 fbe924df437b
parent 3465 2f5b5c14a650
child 3530 ec3672b7532b
permissions -rw-r--r--
tests: rename build_in_docker.sh to do_test_in_docker.sh
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     1
name: Docker Image CI
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:
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     5
    branches: [ wxPython4 ]
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
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    11
    runs-on: ubuntu-latest
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
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    21
          ref: 2a25f4dbf4e2b1e017a3a583db7dede4771fe523
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
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    24
    - name: Cache docker image
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    25
      id: cache-docker
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    26
      uses: actions/cache@v3
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    27
      env:
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    28
        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
    29
      with:
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    30
        path: /tmp/latest.tar
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    31
        key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('beremiz/tests/tools/Docker/beremiz-sikuli') }}
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    32
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    33
    - if: ${{ steps.cache-docker.outputs.cache-hit == false }}
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    34
      name: Create docker image
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    35
      run: |
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    36
        cd beremiz/tests/tools/Docker/beremiz-sikuli
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    37
        ./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
    38
        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
    39
3464
c8f73bd67817 Tests: ...
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3463
diff changeset
    40
    - if: ${{ steps.cache-docker.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: 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
    42
      run: |
3460
d3c95ae44750 Tests: fix docker image export for GitHub Action caching.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3459
diff changeset
    43
        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
    44
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    45
    - name: Create docker container
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    46
      run: |
3459
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    47
        cd beremiz/tests/tools/Docker/beremiz-sikuli
3461
fb8c2fa0d8f0 Tests: give test directory when creating container, not when running test.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3460
diff changeset
    48
        ./create_docker_container.sh ${{ github.workspace }}/test
3456
c0a41c2d0dd1 Create run_tests_in_docker.yml
etisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    49
        
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
    50
    - 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
    51
      run: |
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
    52
        cd beremiz/tests/tools/Docker/beremiz-sikuli
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
    53
        ./build_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
    54
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    55
    - 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
    56
      uses: actions/upload-artifact@v3
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    57
      with:
69771a6ca4a6 Tests: More fixes amd enhancments to run tests on Github Actions
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 3456
diff changeset
    58
        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
    59
        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
    60
        retention-days: 5