| 1 |
name: CI image builder |
| 2 |
|
| 3 |
concurrency: |
| 4 |
group: img_builder-${{ github.head_ref || github.ref }} |
| 5 |
cancel-in-progress: true |
| 6 |
|
| 7 |
on: |
| 8 |
push: |
| 9 |
branches: |
| 10 |
paths: |
| 11 |
- 'ci/ciimage/**' |
| 12 |
- '.github/workflows/images.yml' |
| 13 |
|
| 14 |
pull_request: |
| 15 |
branches: |
| 16 |
- master |
| 17 |
paths: |
| 18 |
- 'ci/ciimage/**' |
| 19 |
- '.github/workflows/images.yml' |
| 20 |
|
| 21 |
# Rebuild the images every week (Sunday) |
| 22 |
schedule: |
| 23 |
- cron: '0 0 * * 0' |
| 24 |
|
| 25 |
permissions: |
| 26 |
contents: read |
| 27 |
|
| 28 |
jobs: |
| 29 |
build: |
| 30 |
# do not run the weekly scheduled job in a fork |
| 31 |
if: github.event_name != 'schedule' || github.repository == 'mesonbuild/meson' |
| 32 |
env: |
| 33 |
HAS_DOCKER_CREDENTIALS: ${{ secrets.DOCKER_PASSWORD != '' }} |
| 34 |
name: ${{ matrix.cfg.name }} |
| 35 |
runs-on: ubuntu-latest |
| 36 |
strategy: |
| 37 |
fail-fast: false |
| 38 |
matrix: |
| 39 |
cfg: |
| 40 |
- { name: Arch Linux, id: arch } |
| 41 |
- { name: CUDA (on Arch), id: cuda } |
| 42 |
- { name: CUDA Cross (on Ubuntu Jammy), id: cuda-cross } |
| 43 |
- { name: Fedora, id: fedora } |
| 44 |
- { name: Gentoo, id: gentoo } |
| 45 |
- { name: OpenSUSE, id: opensuse } |
| 46 |
- { name: Ubuntu Bionic, id: bionic } |
| 47 |
- { name: Ubuntu Rolling, id: ubuntu-rolling } |
| 48 |
steps: |
| 49 |
# Need v3 because of bionic |
| 50 |
- uses: actions/checkout@v3 |
| 51 |
|
| 52 |
# Login to dockerhub |
| 53 |
- name: Docker login |
| 54 |
if: (github.event_name == 'push' || github.event_name == 'schedule') && env.HAS_DOCKER_CREDENTIALS == 'true' |
| 55 |
uses: azure/docker-login@v1 |
| 56 |
with: |
| 57 |
username: ${{ secrets.DOCKER_USERNAME }} |
| 58 |
password: ${{ secrets.DOCKER_PASSWORD }} |
| 59 |
|
| 60 |
# Build and test |
| 61 |
- name: Building the ${{ matrix.cfg.id }} image |
| 62 |
run: ./ci/ciimage/build.py -t build ${{ matrix.cfg.id }} |
| 63 |
- name: Testing the ${{ matrix.cfg.id }} image |
| 64 |
run: ./ci/ciimage/build.py -t test ${{ matrix.cfg.id }} |
| 65 |
|
| 66 |
# Publish |
| 67 |
- name: Push the ${{ matrix.cfg.id }} image |
| 68 |
run: docker push mesonbuild/${{ matrix.cfg.id }} |
| 69 |
if: (github.event_name == 'push' || github.event_name == 'schedule') && env.HAS_DOCKER_CREDENTIALS == 'true' |