OpenFPGA/.github/workflows/docker.yml

86 lines
2.6 KiB
YAML
Raw Normal View History

name: Build docker CI images
on:
- workflow_dispatch
2021-10-18 12:55:43 -05:00
# Environment variables
env:
DOCKER_REPO: ${{ secrets.DOCKER_REPO }}
REPO_OWNER: ${{ github.repository_owner }}
jobs:
base_images:
name: Push Docker images
runs-on: ubuntu-latest
2021-10-18 22:42:39 -05:00
if: ${{ secrets.DOCKER_REPO }}
steps:
- name: Checkout
uses: actions/checkout@v2
2021-10-18 12:55:43 -05:00
- name: Check for source code changes
id: changes
run: |
if [[ -n "${DOCKER_REPO}" ]]; then
2021-10-18 22:42:39 -05:00
echo "name=docker_repo::$REPO_OWNER"
echo "::set-output name=docker_repo::$REPO_OWNER"
2021-10-18 12:55:43 -05:00
else
2021-10-18 13:31:08 -05:00
echo "name=docker_repo::lnis-uofu"
echo "::set-output name=docker_repo::lnis-uofu"
2021-10-18 12:55:43 -05:00
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
2021-10-18 12:55:43 -05:00
username: ${{ needs.change_detect.outputs.docker_repo }}
password: ${{ secrets.CR_PAT }}
- name: Build base
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile.base
push: true
2021-10-18 12:55:43 -05:00
tags: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-base:latest
- name: Build environment image
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile.env
push: true
2021-10-18 12:55:43 -05:00
tags: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-env:latest
compiler_images:
name: Build ${{ matrix.compiler }} compiler image
needs: base_images
runs-on: ubuntu-latest
strategy:
matrix:
compiler:
- gcc-5
- gcc-6
- gcc-7
- gcc-8
- gcc-9
2021-01-04 12:31:14 -06:00
- clang-6.0
- clang-8
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
2021-10-18 12:55:43 -05:00
username: ${{ needs.change_detect.outputs.docker_repo }}
password: ${{ secrets.CR_PAT }}
- name: Build ${{ matrix.compiler }} image
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/Dockerfile.${{ matrix.compiler }}
push: true
2021-10-18 12:55:43 -05:00
tags: ghcr.io/${{ needs.change_detect.outputs.docker_repo }}/openfpga-build-${{ matrix.compiler }}:latest