.github/workflows/build_bundles.yml
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sun, 14 Aug 2022 15:11:20 +0200
changeset 96 52b64ebc1970
parent 93 b1f29a911785
child 97 4dd65c75e651
permissions -rw-r--r--
GH CD: seems that reusable workflow outputs can't make their way through.
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
    - uses: actions/checkout@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
    18
      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
    19
          path: beremiz_public_dist
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
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: 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
    22
      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
    23
      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
    24
        name: source_package
93
b1f29a911785 GH CD: fix artifact decompaction path
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 84
diff changeset
    25
        path: build
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
    26
55
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    27
    - name: Cache docker image
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    28
      id: cache-docker
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    29
      uses: actions/cache@v3
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    30
      env:
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    31
        cache-name: cache-docker
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    32
      with:
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    33
        path: /tmp/latest.tar
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    34
        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
    35
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    36
    - 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
    37
      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
    38
      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
    39
        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
    40
        ./build_docker_image.sh
55
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    41
        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
    42
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    43
    - 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
    44
      name: Re-use docker image
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    45
      run: |
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    46
        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
    47
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    48
    - 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
    49
      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
    50
        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
    51
        ./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
    52
48
e191f60ab947 Github Action Workflow : desperate attempt to pass environment variable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
    53
    - 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
    54
      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
    55
        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
    56
        # override HG revision IDs in Makefile
59
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 56
diff changeset
    57
        ./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
    58
            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
    59
            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
    60
            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
    61
            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
    62
            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
    63
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    64
    - 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
    65
      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
    66
      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
    67
        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
    68
        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
    69
          ${{ 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
    70
          ${{ 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
    71
        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
    72