Skip to content

Commit

Permalink
Merge pull request #2384 from Depetrol/RTI-CD
Browse files Browse the repository at this point in the history
RTI Docker Hub Continuous Deployment with Multiplatform Support
  • Loading branch information
lhstrh authored Aug 2, 2024
2 parents ddf7979 + bd1ddc4 commit 3828049
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 8 deletions.
36 changes: 36 additions & 0 deletions .github/actions/push-rti-docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Push RTI to Docker Hub
description: Build and push the RTI image to Docker Hub
inputs:
tag:
description: 'The tag of the RTI image to build and push'
required: true
default: 'latest'
DOCKERHUB_USERNAME:
description: 'The username to log in to Docker Hub'
required: true
DOCKERHUB_TOKEN:
description: 'The token to log in to Docker Hub'
required: true
runs:
using: "composite"
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ inputs.DOCKERHUB_USERNAME }}
password: ${{ inputs.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Check out lingua-franca repository
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Build and push
uses: docker/build-push-action@v6
with:
file: ./core/src/main/resources/lib/c/reactor-c/core/federated/RTI/rti.Dockerfile
context: ./core/src/main/resources/lib/c/reactor-c
platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/riscv64
push: true
tags: lflang/rti:${{ inputs.tag }}
28 changes: 28 additions & 0 deletions .github/workflows/rti-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Push RTI Image to Docker Hub

on:
push:
branches:
- master
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
name: Build and push RTI to Docker Hub
steps:
- name: Check out lingua-franca repository
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Look up the current version and export as environment variable
run: |
export LF_VERSION=$(cat core/src/main/resources/org/lflang/StringsBundle.properties | sed -n 's/.*VERSION = \(.*\)/\1/p' | tr '[:upper:]' '[:lower:]')
echo "lf_version=$LF_VERSION"
echo "lf_version=$LF_VERSION" >> $GITHUB_ENV
- name: Build and push RTI to Docker Hub
uses: ./.github/actions/push-rti-docker
with:
tag: ${{ env.lf_version }}
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.lflang.target.property;

import org.lflang.LocalStrings;
import org.lflang.MessageReporter;
import org.lflang.ast.ASTUtils;
import org.lflang.lf.Element;
Expand Down Expand Up @@ -149,7 +150,8 @@ public record DockerOptions(
String dockerConfigFile) {

/** Default location to pull the rti from. */
public static final String DOCKERHUB_RTI_IMAGE = "lflang/rti:rti";
public static final String DOCKERHUB_RTI_IMAGE =
"lflang/rti:" + LocalStrings.VERSION.toLowerCase();

public static final String DEFAULT_SHELL = "/bin/sh";

Expand Down
4 changes: 3 additions & 1 deletion test/Python/src/docker/FilesPropertyContainerized.lf
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
target Python {
files: "../include/hello.py",
docker: true
docker: {
rti-image: "rti:local"
}
}

preamble {=
Expand Down
4 changes: 3 additions & 1 deletion test/Python/src/docker/HelloWorldContainerized.lf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
target Python {
docker: true
docker: {
rti-image: "rti:local"
}
}

import HelloWorld2 from "../HelloWorld.lf"
Expand Down
4 changes: 3 additions & 1 deletion test/Python/src/docker/PingPongContainerized.lf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
*/
target Python {
fast: true,
docker: true
docker: {
rti-image: "rti:local"
}
}

import Ping from "../PingPong.lf"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ target Python {
timeout: 5 sec,
logging: DEBUG,
coordination: centralized,
docker: true
docker: {
rti-image: "rti:local"
}
}

import Count from "../../lib/Count.lf"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
target Python {
timeout: 1 sec,
coordination: centralized,
docker: true
docker: {
rti-image: "rti:local"
}
}

import Source, Destination from "../../federated/DistributedMultiport.lf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
target Python {
coordination: centralized,
docker: true
docker: {
rti-image: "rti:local"
}
}

import A, B from "../../federated/DistributedSendClass.lf"
Expand Down

0 comments on commit 3828049

Please sign in to comment.