aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/images.yml
blob: dd4fe9ac4145d2b02895b7573dfa0f4c15bb3af0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: CI image builder

concurrency:
  group: img_builder-${{ github.head_ref || github.ref }}
  cancel-in-progress: true

on:
  push:
    branches:
      - master
    paths:
      - 'ci/ciimage/**'
      - '.github/workflows/images.yml'

  pull_request:
    branches:
      - master
    paths:
      - 'ci/ciimage/**'
      - '.github/workflows/images.yml'

  # Rebuild the images every week (Sunday)
  schedule:
    - cron: '0 0 * * 0'

permissions:
  contents: read

jobs:
  build:
    # do not run the weekly scheduled job in a fork
    if: github.event_name != 'schedule' || github.repository == 'mesonbuild/meson'
    env:
      HAS_DOCKER_CREDENTIALS: ${{ secrets.DOCKER_PASSWORD != '' }}
    name: ${{ matrix.cfg.name }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        cfg:
          - { name: Arch Linux,       id: arch     }
          - { name: CUDA (on Arch),   id: cuda     }
          - { name: Fedora,           id: fedora   }
          - { name: OpenSUSE,         id: opensuse }
          - { name: Ubuntu Bionic,    id: bionic   }
          - { name: Ubuntu Rolling,   id: ubuntu-rolling  }
    steps:
      - uses: actions/checkout@v3

      # Login to dockerhub
      - name: Docker login
        if:   (github.event_name == 'push' || github.event_name == 'schedule') && env.HAS_DOCKER_CREDENTIALS == 'true'
        uses: azure/docker-login@v1
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      # Build and test
      - name: Building the ${{ matrix.cfg.id }} image
        run:  ./ci/ciimage/build.py -t build ${{ matrix.cfg.id }}
      - name: Testing the ${{ matrix.cfg.id }} image
        run:  ./ci/ciimage/build.py -t test  ${{ matrix.cfg.id }}

      # Publish
      - name: Push the ${{ matrix.cfg.id }} image
        run:  docker push mesonbuild/${{ matrix.cfg.id }}
        if:   (github.event_name == 'push' || github.event_name == 'schedule') && env.HAS_DOCKER_CREDENTIALS == 'true'