mirror of
https://github.com/verilator/verilator.git
synced 2025-01-01 04:07:34 +00:00
Add Github action to build and push docker images (#4163)
This commit is contained in:
parent
add68130b8
commit
d693dc85e4
84
.github/workflows/docker.yml
vendored
Normal file
84
.github/workflows/docker.yml
vendored
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
# Build and push verilator docker image when tags are pushed to the repository.
|
||||||
|
# The following secrets must be configured in the github repository:
|
||||||
|
# DOCKER_HUB_NAMESPACE: docker hub namespace.
|
||||||
|
# DOCKER_HUB_USER: user name for logging into docker hub
|
||||||
|
# DOCKER_HUB_ACCESS_TOKEN: docker hub access token.
|
||||||
|
name: Build Verilator Container
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: [ 'v*' ]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
manual_tag:
|
||||||
|
description: 'Git tag to use for image build'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
add_latest_tag:
|
||||||
|
description: 'Tag workflow_dispatch docker image as "latest"'
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
contexts:
|
||||||
|
- "ci/docker/run:verilator"
|
||||||
|
# - "ci/docker/buildenv:verilator-buildenv"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Extract context variables
|
||||||
|
run: |
|
||||||
|
echo "${{ matrix.contexts }}" | sed -r 's/(.*):.*/build_context=\1/' >> "$GITHUB_ENV"
|
||||||
|
echo "${{ matrix.contexts }}" | sed -r 's/.*:(.*)/image_name=\1/' >> "$GITHUB_ENV"
|
||||||
|
echo "git_tag=${GITHUB_REF#refs/*/}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Use manual tag
|
||||||
|
if: ${{ inputs.manual_tag }}
|
||||||
|
run: |
|
||||||
|
echo "git_tag=${{ inputs.manual_tag }}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
- name: Docker meta
|
||||||
|
id: docker_meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ secrets.DOCKER_HUB_NAMESPACE }}/${{ env.image_name }}
|
||||||
|
tags: |
|
||||||
|
type=match,pattern=(v.*),group=1,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||||
|
type=raw,value=${{ inputs.manual_tag }},enable=${{ inputs.manual_tag != '' }}
|
||||||
|
type=raw,value=latest,enable=${{ inputs.add_latest_tag == true }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
buildkitd-flags: --debug
|
||||||
|
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USER }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Push to Docker
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
with:
|
||||||
|
context: ${{ env.build_context }}
|
||||||
|
build-args: SOURCE_COMMIT=${{ env.git_tag }}
|
||||||
|
platforms: linux/arm64,linux/amd64
|
||||||
|
push: ${{ !env.ACT && startsWith(github.ref, 'refs/tags/v') }}
|
||||||
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
@ -13,6 +13,8 @@
|
|||||||
:target: https://codecov.io/gh/verilator/verilator
|
:target: https://codecov.io/gh/verilator/verilator
|
||||||
.. image:: https://github.com/verilator/verilator/workflows/build/badge.svg
|
.. image:: https://github.com/verilator/verilator/workflows/build/badge.svg
|
||||||
:target: https://github.com/verilator/verilator/actions?query=workflow%3Abuild
|
:target: https://github.com/verilator/verilator/actions?query=workflow%3Abuild
|
||||||
|
.. image:: https://img.shields.io/docker/pulls/verilator/verilator
|
||||||
|
:target: https://hub.docker.com/r/verilator/verilator
|
||||||
|
|
||||||
|
|
||||||
Welcome to Verilator
|
Welcome to Verilator
|
||||||
|
@ -19,10 +19,16 @@ RUN apt-get update \
|
|||||||
ccache \
|
ccache \
|
||||||
flex \
|
flex \
|
||||||
git \
|
git \
|
||||||
|
help2man \
|
||||||
|
libfl2 \
|
||||||
libfl-dev \
|
libfl-dev \
|
||||||
libgoogle-perftools-dev \
|
libgoogle-perftools-dev \
|
||||||
|
numactl \
|
||||||
perl \
|
perl \
|
||||||
|
perl-doc \
|
||||||
python3 \
|
python3 \
|
||||||
|
zlib1g \
|
||||||
|
zlib1g-dev \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
@ -39,7 +45,7 @@ RUN git clone "${REPO}" verilator && \
|
|||||||
git checkout "${SOURCE_COMMIT}" && \
|
git checkout "${SOURCE_COMMIT}" && \
|
||||||
autoconf && \
|
autoconf && \
|
||||||
./configure && \
|
./configure && \
|
||||||
make -j "$(nproc)" && \
|
make && \
|
||||||
make install && \
|
make install && \
|
||||||
cd .. && \
|
cd .. && \
|
||||||
rm -r verilator
|
rm -r verilator
|
||||||
|
@ -72,6 +72,7 @@ Joey Liu
|
|||||||
John Coiner
|
John Coiner
|
||||||
John Demme
|
John Demme
|
||||||
Jonathan Drolet
|
Jonathan Drolet
|
||||||
|
Jose Loyola
|
||||||
Joseph Nwabueze
|
Joseph Nwabueze
|
||||||
Josep Sans
|
Josep Sans
|
||||||
Josh Redford
|
Josh Redford
|
||||||
|
Loading…
Reference in New Issue
Block a user