|
| 1 | +name: CI |
| 2 | +# Run tests on pull requests and after "merges" |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: [main] |
| 8 | +jobs: |
| 9 | + # Do a build/compile smoke test |
| 10 | + build: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/setup-go@v2 |
| 14 | + with: |
| 15 | + go-version: ">=1.17.0" |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - name: Build |
| 18 | + run: make |
| 19 | + # Run static/code-quality checks |
| 20 | + check: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/setup-go@v2 |
| 24 | + with: |
| 25 | + go-version: ">=1.17.0" |
| 26 | + - uses: actions/checkout@v2 |
| 27 | + - name: Install build tools |
| 28 | + run: make build-tools |
| 29 | + - name: Run checks |
| 30 | + run: make check |
| 31 | + podmanbuild: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + # don't run on push, since the "push" job contains the |
| 34 | + # image build step, so no need to do it twice. |
| 35 | + if: github.event_name == 'pull_request' |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v2 |
| 38 | + - name: Install fuse-overlayfs |
| 39 | + run: sudo apt-get -y install fuse-overlayfs |
| 40 | + - name: Setup podman config |
| 41 | + run: | |
| 42 | + mkdir -p /home/runner/.config/containers/ |
| 43 | + cat >/home/runner/.config/containers/storage.conf <<EOF |
| 44 | + [storage] |
| 45 | + driver = "overlay" |
| 46 | + graphroot = "${HOME}/.local/share/containers/storage2" |
| 47 | +
|
| 48 | + [storage.options] |
| 49 | + mount_program = "/usr/bin/fuse-overlayfs" |
| 50 | + EOF |
| 51 | + cat >/home/runner/.config/containers/containers.conf <<EOF |
| 52 | + [containers] |
| 53 | + netns = "host" |
| 54 | + EOF |
| 55 | + - name: build container image |
| 56 | + # note: forcing use of podman here since we are |
| 57 | + # using podman explicitly for the push job |
| 58 | + run: make CONTAINER_CMD=podman image-build |
| 59 | + dockerbuild: |
| 60 | + runs-on: ubuntu-latest |
| 61 | + # don't run on push, since the "push" job contains the |
| 62 | + # image build step, so no need to do it twice. |
| 63 | + if: github.event_name == 'pull_request' |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v2 |
| 66 | + - name: build container image |
| 67 | + # note: forcing use of podman here since we are |
| 68 | + # using podman explicitly for the push job |
| 69 | + run: make CONTAINER_CMD=docker image-build |
| 70 | + # push the container to quay.io - only for pushes, not PRs |
| 71 | + push: |
| 72 | + needs: [build, check] |
| 73 | + runs-on: ubuntu-latest |
| 74 | + if: github.event_name == 'push' |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v2 |
| 77 | + - name: log in to quay.io |
| 78 | + # using docker for now, since podman has an issue with space |
| 79 | + # consumption: image build fails with no space left on device... |
| 80 | + run: echo "${{ secrets.QUAY_PASS }}" | docker login -u "${{ secrets.QUAY_USER }}" --password-stdin quay.io |
| 81 | + - name: build container image |
| 82 | + # note: forcing use of docker here, since we did docker login above |
| 83 | + run: make CONTAINER_CMD=docker image-build |
| 84 | + - name: push container image |
| 85 | + # note: forcing use of docker here, since we did docker login above |
| 86 | + run: make CONTAINER_CMD=docker container-push |
0 commit comments