.github/workflows/build_bundles.yml
author Edouard Tisserant <edouard.tisserant@gmail.com>
Sun, 31 Jul 2022 17:54:19 +0200
changeset 80 1088ce57d3c9
parent 78 38597d675b03
child 84 8e01f3bb59df
permissions -rw-r--r--
Add (untested) snapcraft workflow for GitHub action. Add documentation about manual snapcraft invokation.
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
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
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    42
    - 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
    43
      name: Re-use docker image
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    44
      run: |
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    45
        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
    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
    - 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
    48
      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
    49
        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
    50
        ./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
    51
48
e191f60ab947 Github Action Workflow : desperate attempt to pass environment variable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
    52
    - 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
    53
      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
    54
        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
    55
        # override HG revision IDs in Makefile
59
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 56
diff changeset
    56
        ./build_in_docker.sh \
68
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
    57
            beremiz_revisionid=${{ needs.sources.outputs.beremiz_revisionid }} \
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
    58
            matiec_revisionid=${{ needs.sources.outputs.matiec_revisionid }} \
8eb533b797be GH action : split workflows for later re-use of source provisioning.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 67
diff changeset
    59
            canfestival_revisionid=${{ needs.sources.outputs.canfestival_revisionid }}
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
    60
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    61
    - 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
    62
      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
    63
      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
    64
        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
    65
        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
    66
          ${{ 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
    67
          ${{ 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
    68
        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
    69