images.yml 2.0 KB

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