.github/workflows/build_bundles.yml
author Edouard Tisserant <edouard.tisserant@gmail.com>
Fri, 20 May 2022 18:41:18 +0200
changeset 65 a5970360c00b
parent 60 207d2bb3ebd7
child 67 d06ee9c3f780
permissions -rw-r--r--
...
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
     1
name: Build distributable 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
     2
49
2f9209945146 Fix syntax errors in build_bundles.yml
etisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
     3
# This overrides HG revision IDs in Makefile
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
     4
env:
49
2f9209945146 Fix syntax errors in build_bundles.yml
etisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
     5
    beremiz_revisionid: 9fb2ded4f1988440faf546488ee83373825330f4
2f9209945146 Fix syntax errors in build_bundles.yml
etisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
     6
    matiec_revisionid: 2a25f4dbf4e2b1e017a3a583db7dede4771fe523
52
3b23cd88a197 Rename CanFestival-3 repo into canfestival. CamelCase and '-' in repo name are silly.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 51
diff changeset
     7
    canfestival_revisionid: 12a05e422666c738d1312259703f80150c747cb5
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
     8
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     9
on:
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    10
  push:
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
    branches: [ default ]
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
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
jobs:
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
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
  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
    16
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    17
    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
    18
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    19
    steps:
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    20
    - uses: actions/checkout@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
    21
      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
    22
          path: 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
    23
49
2f9209945146 Fix syntax errors in build_bundles.yml
etisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
    24
    # repositories are directly checked out wher Makerfile expect them
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
    25
    - uses: actions/checkout@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
    26
      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
    27
          repository: beremiz/beremiz
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    28
          ref: ${{ env.beremiz_revisionid }}
53
11a61f120e22 GH Action workflow: more acurate makefile target touching
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 52
diff changeset
    29
          path: build/sources/beremiz
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
    30
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    31
    - uses: actions/checkout@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
    32
      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
    33
          repository: beremiz/matiec
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    34
          ref: ${{ env.matiec_revisionid }}
53
11a61f120e22 GH Action workflow: more acurate makefile target touching
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 52
diff changeset
    35
          path: build/sources/matiec
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
    36
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
    - uses: actions/checkout@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
    38
      with:
52
3b23cd88a197 Rename CanFestival-3 repo into canfestival. CamelCase and '-' in repo name are silly.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 51
diff changeset
    39
          repository: beremiz/canfestival
3b23cd88a197 Rename CanFestival-3 repo into canfestival. CamelCase and '-' in repo name are silly.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 51
diff changeset
    40
          ref: ${{ env.canfestival_revisionid }}
53
11a61f120e22 GH Action workflow: more acurate makefile target touching
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 52
diff changeset
    41
          path: build/sources/canfestival
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
    42
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    43
    - name: Touch expected Makfile targets to shortcut HG checkout
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    44
      run: |
53
11a61f120e22 GH Action workflow: more acurate makefile target touching
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 52
diff changeset
    45
        touch build/sources/beremiz_${{ env.beremiz_revisionid }}
11a61f120e22 GH Action workflow: more acurate makefile target touching
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 52
diff changeset
    46
        touch build/sources/matiec_${{ env.matiec_revisionid }}
11a61f120e22 GH Action workflow: more acurate makefile target touching
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 52
diff changeset
    47
        touch build/sources/canfestival_${{ env.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
    48
        touch build/sources/beremiz_src
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
        touch build/sources/matiec_src
52
3b23cd88a197 Rename CanFestival-3 repo into canfestival. CamelCase and '-' in repo name are silly.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 51
diff changeset
    50
        touch build/sources/canfestival_src
56
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 55
diff changeset
    51
        touch build/sources/own_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
    52
        cat >> build/revisions.txt <<EOF
49
2f9209945146 Fix syntax errors in build_bundles.yml
etisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
    53
        beremiz_public_dist ${{ github.sha }}
2f9209945146 Fix syntax errors in build_bundles.yml
etisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
    54
        beremiz ${{ env.beremiz_revisionid }}
2f9209945146 Fix syntax errors in build_bundles.yml
etisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
    55
        matiec ${{ env.matiec_revisionid }}
52
3b23cd88a197 Rename CanFestival-3 repo into canfestival. CamelCase and '-' in repo name are silly.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 51
diff changeset
    56
        canfestival ${{ env.canfestival_revisionid }}
49
2f9209945146 Fix syntax errors in build_bundles.yml
etisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
    57
        EOF
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
    58
55
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    59
    - name: Cache docker image
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    60
      id: cache-docker
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    61
      uses: actions/cache@v3
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    62
      env:
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    63
        cache-name: cache-docker
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    64
      with:
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    65
        path: /tmp/latest.tar
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    66
        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
    67
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    68
    - 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
    69
      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
    70
      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
    71
        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
    72
        ./build_docker_image.sh
55
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    73
        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
    74
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    75
    - 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
    76
      name: Re-use docker image
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    77
      run: |
399397ddd568 GH Actions: Add caching for Docker image
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 53
diff changeset
    78
        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
    79
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
    - 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
    81
      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
    82
        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
    83
        ./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
    84
48
e191f60ab947 Github Action Workflow : desperate attempt to pass environment variable.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 46
diff changeset
    85
    - 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
    86
      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
    87
        cd beremiz_public_dist
59
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 56
diff changeset
    88
        ./build_in_docker.sh \
60
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 59
diff changeset
    89
            beremiz_revisionid=${{ env.beremiz_revisionid }} \
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 59
diff changeset
    90
            matiec_revisionid=${{ env.matiec_revisionid }} \
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 59
diff changeset
    91
            canfestival_revisionid=${{ env.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
    92
0c4dd1cd0988 Add GitHub Actions workflow file to build windows bundles on push to default branch.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    93
    - 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
    94
      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
    95
      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
    96
        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
    97
        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
    98
          ${{ 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
    99
          ${{ 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
   100
        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
   101