.github/workflows/build_bundles.yml
author Edouard Tisserant <edouard.tisserant@gmail.com>
Fri, 20 May 2022 14:49:18 +0200
changeset 60 207d2bb3ebd7
parent 59 872aa7d30b4f
child 67 d06ee9c3f780
permissions -rw-r--r--
...
name: Build distributable bundles

# This overrides HG revision IDs in Makefile
env:
    beremiz_revisionid: 9fb2ded4f1988440faf546488ee83373825330f4
    matiec_revisionid: 2a25f4dbf4e2b1e017a3a583db7dede4771fe523
    canfestival_revisionid: 12a05e422666c738d1312259703f80150c747cb5

on:
  push:
    branches: [ default ]

jobs:

  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
      with:
          path: beremiz_public_dist

    # repositories are directly checked out wher Makerfile expect them
    - uses: actions/checkout@v3
      with:
          repository: beremiz/beremiz
          ref: ${{ env.beremiz_revisionid }}
          path: build/sources/beremiz

    - uses: actions/checkout@v3
      with:
          repository: beremiz/matiec
          ref: ${{ env.matiec_revisionid }}
          path: build/sources/matiec

    - uses: actions/checkout@v3
      with:
          repository: beremiz/canfestival
          ref: ${{ env.canfestival_revisionid }}
          path: build/sources/canfestival

    - name: Touch expected Makfile targets to shortcut HG checkout
      run: |
        touch build/sources/beremiz_${{ env.beremiz_revisionid }}
        touch build/sources/matiec_${{ env.matiec_revisionid }}
        touch build/sources/canfestival_${{ env.canfestival_revisionid }}
        touch build/sources/beremiz_src
        touch build/sources/matiec_src
        touch build/sources/canfestival_src
        touch build/sources/own_sources
        cat >> build/revisions.txt <<EOF
        beremiz_public_dist ${{ github.sha }}
        beremiz ${{ env.beremiz_revisionid }}
        matiec ${{ env.matiec_revisionid }}
        canfestival ${{ env.canfestival_revisionid }}
        EOF

    - name: Cache docker image
      id: cache-docker
      uses: actions/cache@v3
      env:
        cache-name: cache-docker
      with:
        path: /tmp/latest.tar
        key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('beremiz_public_dist/Dockerfile', 'beremiz_public_dist/*.sh') }}

    - if: ${{ steps.cache-docker.outputs.cache-hit == false }}
      name: Create docker image
      run: |
        cd beremiz_public_dist
        ./build_docker_image.sh
        docker image save --output="/tmp/latest.tar" beremiz_public_builder

    - if: ${{ steps.cache-docker.outputs.cache-hit != false }}
      name: Re-use docker image
      run: |
        docker image load --input="/tmp/latest.tar" 

    - name: Create docker container
      run: |
        cd beremiz_public_dist
        ./create_docker_container.sh ${{ github.workspace }}/build

    - name: Run build in docker
      run: |
        cd beremiz_public_dist
        ./build_in_docker.sh \
            beremiz_revisionid=${{ env.beremiz_revisionid }} \
            matiec_revisionid=${{ env.matiec_revisionid }} \
            canfestival_revisionid=${{ env.canfestival_revisionid }}

    - name: Upload built artifact
      uses: actions/upload-artifact@v3
      with:
        name: windows_bundles
        path: |
          ${{ github.workspace }}/build/Beremiz-*.exe
          ${{ github.workspace }}/build/Beremiz-*.zip
        retention-days: 5