Skip to content
Snippets Groups Projects
build-gluon.yml 1.91 KiB
Newer Older
  • Learn to ignore specific revisions
  • David Bauer's avatar
    David Bauer committed
    name: Build Gluon
    on:
      push:
    
          - next
          - 'v20[2-9][0-9].[0-9].x'
    
    David Bauer's avatar
    David Bauer committed
      pull_request:
        types: [opened, synchronize, reopened]
    
    permissions:
      contents: read
    
    
    concurrency:
      group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-${{ github.event.pull_request.number || github.run_id }}
      cancel-in-progress: true
    
    
    David Bauer's avatar
    David Bauer committed
    jobs:
    
        permissions:
          contents: read  # for dorny/paths-filter to fetch a list of changed files
          pull-requests: read  # for dorny/paths-filter to read pull requests
    
        runs-on: ubuntu-22.04
    
        outputs:
          targets: ${{ steps.filter.outputs.changes }}
        steps:
    
          - uses: actions/checkout@v4
    
    
          # Filter targets based on changed files
    
          - uses: dorny/paths-filter@v3
    
            id: filter
            with:
              filters: .github/filters.yml
    
    
      build_firmware:
    
        needs: changed
    
        if: ${{ needs.changed.outputs.targets != '[]' && needs.changed.outputs.targets != '' }}
    
        strategy:
          fail-fast: false
          matrix:
    
            # Read back changed targets to create build matrix
    
            target: ${{ fromJSON(needs.changed.outputs.targets) }}
    
        runs-on: ubuntu-22.04
    
    David Bauer's avatar
    David Bauer committed
        steps:
    
          - uses: actions/checkout@v4
    
          - name: Show system information
            run: contrib/actions/show-system-info.sh
    
    
          - name: Build Docker container
            run: docker build -t gluon-ci-container contrib/docker
    
          - name: Build Gluon
            run: docker run --rm -v $PWD:/gluon-ci -w /gluon-ci --user "$(id -u):$(id -g)" gluon-ci-container contrib/actions/run-build.sh ${{ matrix.target }}
    
          - name: Archive build logs
            if: ${{ !cancelled() }}
    
            uses: actions/upload-artifact@v4
    
              name: ${{ matrix.target }}_logs
    
    David Bauer's avatar
    David Bauer committed
          - name: Archive build output
    
            uses: actions/upload-artifact@v4
    
    David Bauer's avatar
    David Bauer committed
            with:
    
              name: ${{ matrix.target }}_output
    
    David Bauer's avatar
    David Bauer committed
              path: output