diff --git a/.github/actions/push-rti-docker/action.yml b/.github/actions/push-rti-docker/action.yml new file mode 100644 index 0000000000..83fb67ff3b --- /dev/null +++ b/.github/actions/push-rti-docker/action.yml @@ -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 }} diff --git a/.github/workflows/rti-docker.yml b/.github/workflows/rti-docker.yml new file mode 100644 index 0000000000..c0762900c6 --- /dev/null +++ b/.github/workflows/rti-docker.yml @@ -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 }} diff --git a/core/src/main/java/org/lflang/target/property/DockerProperty.java b/core/src/main/java/org/lflang/target/property/DockerProperty.java index c9e3a27de7..fd5383653a 100644 --- a/core/src/main/java/org/lflang/target/property/DockerProperty.java +++ b/core/src/main/java/org/lflang/target/property/DockerProperty.java @@ -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; @@ -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"; diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 543b738636..4026514ff1 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 543b7386362f0a17e4804c8b6eee5c5f1f64cf8b +Subproject commit 4026514ff116ca492fb47086cafd86118e4ce9ae diff --git a/test/Python/src/docker/FilesPropertyContainerized.lf b/test/Python/src/docker/FilesPropertyContainerized.lf index 139f1b682a..800e020f04 100644 --- a/test/Python/src/docker/FilesPropertyContainerized.lf +++ b/test/Python/src/docker/FilesPropertyContainerized.lf @@ -1,6 +1,8 @@ target Python { files: "../include/hello.py", - docker: true + docker: { + rti-image: "rti:local" + } } preamble {= diff --git a/test/Python/src/docker/HelloWorldContainerized.lf b/test/Python/src/docker/HelloWorldContainerized.lf index 26e684c580..64df9fb222 100644 --- a/test/Python/src/docker/HelloWorldContainerized.lf +++ b/test/Python/src/docker/HelloWorldContainerized.lf @@ -1,5 +1,7 @@ target Python { - docker: true + docker: { + rti-image: "rti:local" + } } import HelloWorld2 from "../HelloWorld.lf" diff --git a/test/Python/src/docker/PingPongContainerized.lf b/test/Python/src/docker/PingPongContainerized.lf index 1539a12615..708d4213ff 100644 --- a/test/Python/src/docker/PingPongContainerized.lf +++ b/test/Python/src/docker/PingPongContainerized.lf @@ -19,7 +19,9 @@ */ target Python { fast: true, - docker: true + docker: { + rti-image: "rti:local" + } } import Ping from "../PingPong.lf" diff --git a/test/Python/src/docker/federated/DistributedCountContainerized.lf b/test/Python/src/docker/federated/DistributedCountContainerized.lf index 48b71bd046..785467d12f 100644 --- a/test/Python/src/docker/federated/DistributedCountContainerized.lf +++ b/test/Python/src/docker/federated/DistributedCountContainerized.lf @@ -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" diff --git a/test/Python/src/docker/federated/DistributedMultiportContainerized.lf b/test/Python/src/docker/federated/DistributedMultiportContainerized.lf index b4333d8c00..1c07a9c174 100644 --- a/test/Python/src/docker/federated/DistributedMultiportContainerized.lf +++ b/test/Python/src/docker/federated/DistributedMultiportContainerized.lf @@ -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" diff --git a/test/Python/src/docker/federated/DistributedSendClassContainerized.lf b/test/Python/src/docker/federated/DistributedSendClassContainerized.lf index 797a017146..c13fbea651 100644 --- a/test/Python/src/docker/federated/DistributedSendClassContainerized.lf +++ b/test/Python/src/docker/federated/DistributedSendClassContainerized.lf @@ -1,6 +1,8 @@ target Python { coordination: centralized, - docker: true + docker: { + rti-image: "rti:local" + } } import A, B from "../../federated/DistributedSendClass.lf"