acados / tera_renderer

Tera-based renderer for acados templated code
1 stars 5 forks source link

Aarch64 TravisCI #7

Closed Tim-Salzmann closed 11 months ago

Tim-Salzmann commented 1 year ago

Hi Jonathan,

Thanks for the great work. I started using tera_renderer for L4CasADi too.

Did you look into adding aarch64 (arm64) to your travis build ci [1]? Is there a particular reason preventing this? This would enable Acados (and L4CasADi) to run on arm devices (including M1/M2 I think) without having to manually build tera_renderer.

Thanks Tim

[1] https://docs.travis-ci.com/user/multi-cpu-architectures/

FreyJo commented 11 months ago

Hi Tim,

sorry for the late reply! I did not look into that, but it surely seems possible and would be appreciated. I just pushed a commit to try this, but it does not seem that Travis is still running on this repo. Overall, travis doesn't have a free tier anymore it seems. I guess, it would make sense to move the whole build CI to Github Actions. But I don't really have time for that now. A PR for that would of course be welcome.

Interesting that you use tera in L4CasADi now, I also might use it in a project soon :) Best, Jonathan

Tim-Salzmann commented 11 months ago

Hi Jonathan,

Thanks for the answer. I'll look into building tera with Github Actions in the next days.

I also might use it in a project soon :)

Great! Let me know if you have any feedback or questions!

Best Tim

Tim-Salzmann commented 11 months ago

Hi Jonathan,

I gave it a quick try this morning. However, I ended up deciding to switch to a pure Python rendering solution jinja2 such that there are no extra downloads (and Mac complaining about security executing downloaded executables).

I will attach the github action, which automatically builds t_renderer for linux, osx and aarch64. It may still be useful for you - what is left is adding an action to automatically add the action artifacts to a release.

name: Releases

on: push
#  push:
#    tags:
#    - '*'

jobs:
  build:
    runs-on: ${{ matrix.runs-on }}
    timeout-minutes: 60
    strategy:
      fail-fast: false
      matrix:
        include:
          - runs-on: ubuntu-latest
            architecture: linux-amd64
          - runs-on: macos-latest
            architecture: osx-amd64

    name: Build on ${{ matrix.runs-on }}

    steps:
      - name: Setup | Rust
        uses: ATiltedTree/setup-rust@v1
        with:
          rust-version: stable
      - name: Checkout
        uses: actions/checkout@v3
      - name: Build
        run: |
          cargo build --verbose --release;

      - name: Upload t_renderer Artifact
        uses: actions/upload-artifact@v3.1.3
        with:
          name: t_renderer-${{ matrix.architecture }}
          path: target/release/t_renderer

  build-on-aarch:
    runs-on: ubuntu-latest
    timeout-minutes: 60

    name: Build on aarch64
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Build in aarch64 Docker
        uses: uraimo/run-on-arch-action@v2
        with:
          arch: aarch64
          distro: ubuntu_latest
          setup: |
            mkdir -p "${PWD}/artifacts"
          dockerRunArgs: |
            --volume "${PWD}/artifacts:/artifacts"
          install: |
            apt-get update
            apt-get install -y curl build-essential
            curl https://sh.rustup.rs -sSf | sh -s -- -y

          run: |
            $HOME/.cargo/bin/cargo build --verbose --release;
            cp target/release/t_renderer /artifacts/t_renderer

      - name: Upload t_renderer Artifact
        uses: actions/upload-artifact@v3.1.3
        with:
          name: t_renderer-aarch64
          path: artifacts/t_renderer
FreyJo commented 11 months ago

I ended up deciding to switch to a pure Python rendering solution jinja2.

I think that is a valid decision. In acados, we also use Tera for the Matlab interface. Thanks for the Github actions code, I hope I can continue on it soonish :)