.github/workflows/build_bundles.yml
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sat, 07 Oct 2023 17:37:00 +0200
changeset 123 032aaa29f498
parent 122 ef1c44f741e3
permissions -rw-r--r--
Add Python3 in Snap build + doc fixes
80
1088ce57d3c9 Add (untested) snapcraft workflow for GitHub action. Add documentation about manual snapcraft invokation.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 78
diff changeset
     1
name: Build windows installer in Docker
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
on:
68
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
     4
  workflow_dispatch:
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
     5
  # push:
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
     6
  #   branches: [ default ]
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
jobs:
68
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
     9
  sources:
75
880a5e48084a GH CI : fix workflow re-use path
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 74
diff changeset
    10
    uses: ./.github/workflows/prep_sources.yml
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    11
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    12
  build:
78
38597d675b03 GH CI : add job 'needs' to ensure artifact is ready
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 77
diff changeset
    13
    needs: sources
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    14
    runs-on: ubuntu-latest
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    15
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    16
    steps:
77
2f3d1cd0bd64 GH CI : use artifacts to get data flowing from one workflow to the other
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 75
diff changeset
    17
2f3d1cd0bd64 GH CI : use artifacts to get data flowing from one workflow to the other
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 75
diff changeset
    18
    - name: Download source artifact
2f3d1cd0bd64 GH CI : use artifacts to get data flowing from one workflow to the other
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 75
diff changeset
    19
      uses: actions/download-artifact@v3
2f3d1cd0bd64 GH CI : use artifacts to get data flowing from one workflow to the other
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 75
diff changeset
    20
      with:
2f3d1cd0bd64 GH CI : use artifacts to get data flowing from one workflow to the other
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 75
diff changeset
    21
        name: source_package
97
4dd65c75e651 GH CD: Seriously ? https://github.com/actions/upload-artifact#maintaining-file-permissions-and-case-sensitive-files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 96
diff changeset
    22
4dd65c75e651 GH CD: Seriously ? https://github.com/actions/upload-artifact#maintaining-file-permissions-and-case-sensitive-files
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 96
diff changeset
    23
    - name: untar files
99
0623d6d4616b GH CD: chechout all projects, even self from prep_sources.yml so that revisions.txt is not too old for Makefile.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 97
diff changeset
    24
      run: tar -xvf sources.tar
77
2f3d1cd0bd64 GH CI : use artifacts to get data flowing from one workflow to the other
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 75
diff changeset
    25
55
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    26
    - name: Cache docker image
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    27
      id: cache-docker
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    28
      uses: actions/cache@v3
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    29
      env:
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    30
        cache-name: cache-docker
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    31
      with:
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    32
        path: /tmp/latest.tar
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    33
        key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('beremiz_public_dist/Dockerfile', 'beremiz_public_dist/*.sh') }}
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    34
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    35
    - if: ${{ steps.cache-docker.outputs.cache-hit == false }}
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    36
      name: Create docker image
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    37
      run: |
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    38
        cd beremiz_public_dist
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    39
        ./build_docker_image.sh
55
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    40
        docker image save --output="/tmp/latest.tar" beremiz_public_builder
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    41
122
ef1c44f741e3 Always cache docker image + default windows target
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 99
diff changeset
    42
ef1c44f741e3 Always cache docker image + default windows target
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 99
diff changeset
    43
    - if: ${{ steps.cache-docker.outputs.cache-hit == false }}
ef1c44f741e3 Always cache docker image + default windows target
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 99
diff changeset
    44
      name: Save docker image in cache
ef1c44f741e3 Always cache docker image + default windows target
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 99
diff changeset
    45
      id: cache-docker-save
ef1c44f741e3 Always cache docker image + default windows target
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 99
diff changeset
    46
      uses: actions/cache/save@v3
ef1c44f741e3 Always cache docker image + default windows target
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 99
diff changeset
    47
      with:
ef1c44f741e3 Always cache docker image + default windows target
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 99
diff changeset
    48
        path: /tmp/latest.tar
ef1c44f741e3 Always cache docker image + default windows target
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 99
diff changeset
    49
        key: ${{ steps.cache-docker.outputs.cache-primary-key }}
ef1c44f741e3 Always cache docker image + default windows target
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 99
diff changeset
    50
55
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    51
    - if: ${{ steps.cache-docker.outputs.cache-hit != false }}
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    52
      name: Re-use docker image
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    53
      run: |
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    54
        docker image load --input="/tmp/latest.tar" 
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    55
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    56
    - name: Create docker container
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    57
      run: |
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    58
        cd beremiz_public_dist
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    59
        ./create_docker_container.sh ${{ github.workspace }}/build
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    60
48
e191f60ab947 Github Action Workflow : desperate attempt to pass environment variable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
    61
    - name: Run build in docker
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    62
      run: |
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    63
        cd beremiz_public_dist
68
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
    64
        # override HG revision IDs in Makefile
59
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 56
diff changeset
    65
        ./build_in_docker.sh \
96
52b64ebc1970 GH CD: seems that reusable workflow outputs can't make their way through.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 93
diff changeset
    66
            beremiz_revisionid=stamp \
52b64ebc1970 GH CD: seems that reusable workflow outputs can't make their way through.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 93
diff changeset
    67
            matiec_revisionid=stamp \
52b64ebc1970 GH CD: seems that reusable workflow outputs can't make their way through.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 93
diff changeset
    68
            canfestival_revisionid=stamp \
52b64ebc1970 GH CD: seems that reusable workflow outputs can't make their way through.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 93
diff changeset
    69
            Modbus_revisionid=stamp \
52b64ebc1970 GH CD: seems that reusable workflow outputs can't make their way through.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 93
diff changeset
    70
            open62541_revisionid=stamp
46
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    71
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    72
    - name: Upload built artifact
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    73
      uses: actions/upload-artifact@v3
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    74
      with:
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    75
        name: windows_bundles
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    76
        path: |
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    77
          ${{ github.workspace }}/build/Beremiz-*.exe
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    78
          ${{ github.workspace }}/build/Beremiz-*.zip
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    79
        retention-days: 5
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    80