Skip to content

Commit

Permalink
ci: use ghcr.io/vunit/dev to push and pull the NVC container image
Browse files Browse the repository at this point in the history
  • Loading branch information
umarcor authored and LarsAsplund committed Mar 9, 2023
1 parent 5f96912 commit 1bc4d06
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 34 deletions.
10 changes: 0 additions & 10 deletions .github/nvc.dockerfile

This file was deleted.

66 changes: 48 additions & 18 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'images'
name: 'Container images'

on:
push:
Expand All @@ -13,7 +13,9 @@ env:
DOCKER_BUILDKIT: '1'

jobs:
build:


GHDL:
strategy:
fail-fast: false
matrix:
Expand All @@ -24,26 +26,54 @@ jobs:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3
- name: 🧰 Checkout
uses: actions/checkout@v3

- name: Build image
env:
TAG: ${{ matrix.task.tag }}
PKG: ${{ matrix.task.pkg }}
run: |
- name: '🛳️ Build container image'
run: >-
TAG=${{ matrix.task.tag }}
PKG=${{ matrix.task.pkg }}
./.github/images.sh
- name: Login to ghcr.io
- name: '🛰️ Push container image to registry'
if: github.event_name != 'pull_request' && github.repository == 'VUnit/vunit'
uses: docker/login-action@v1
uses: pyTooling/Actions/with-post-step@r0
with:
registry: ghcr.io
username: gha
password: ${{ github.token }}
main: |
echo '${{ github.token }}' | docker login ghcr.io -u gha --password-stdin
DIMG="vunit/dev/${{ matrix.task.tag }}"
docker tag "$DIMG" "ghcr.io/$DIMG"
docker push "ghcr.io/$DIMG"
post: for registry in gcr.io ghcr.io docker.io; do docker logout "$registry"; done

- name: Docker push
if: github.event_name != 'pull_request' && github.repository == 'VUnit/vunit'

NVC:
runs-on: ubuntu-latest
steps:

- name: 🧰 Checkout
uses: actions/checkout@v3

- name: '🛳️ Build container image'
run: |
DIMG="vunit/dev/${{ matrix.task.tag }}"
docker tag "$DIMG" "ghcr.io/$DIMG"
docker push "ghcr.io/$DIMG"
docker build -t ghcr.io/vunit/dev/nvc -<<EOF
FROM gcr.io/hdl-containers/nvc
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
python3-pip \
&& apt-get autoclean && apt-get clean && apt-get -y autoremove \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN pip install -U tox colorama coverage --progress-bar off
EOF
- name: '🛰️ Push container image to registry'
if: github.event_name != 'pull_request' && github.repository == 'VUnit/vunit'
uses: pyTooling/Actions/with-post-step@r0
with:
main: |
echo '${{ github.token }}' | docker login ghcr.io -u gha --password-stdin
docker push ghcr.io/vunit/dev/nvc
post: for registry in gcr.io ghcr.io docker.io; do docker logout "$registry"; done
16 changes: 10 additions & 6 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
# Docker (Linux) tests (GHDL)
#

docker:
ghdl:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -115,11 +115,10 @@ jobs:
with:
submodules: recursive

- name: '🛳️ Build container image'
run: docker build -t vunit/nvc - < .github/nvc.dockerfile

- name: '🚧 Run job'
run: docker run --rm -tv $(pwd):/src -w /src vunit/nvc tox -e py${{ matrix.task.do }}-nvc
uses: docker://ghcr.io/vunit/dev/nvc
with:
args: tox -e py${{ matrix.task.do }}-nvc

#
# Windows (MSYS2) with 'nightly' GHDL
Expand Down Expand Up @@ -171,7 +170,12 @@ jobs:

deploy:
runs-on: ubuntu-latest
needs: [ fmt, lin, docker, win ]
needs:
- fmt
- lin
- ghdl
- nvc
- win
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
name: '🚀 Deploy'
steps:
Expand Down

0 comments on commit 1bc4d06

Please sign in to comment.