Requirement, calcit-runner currently provides a cr_once command to run CI scripts. The original CR command had dependencies on SDL2 and FSwatch, which was an inconvenient scenario. So the cr_once command is compiled and hosted at http://bin.calcit-lang.org/li… .

Other projects that run GitHub Actions need to be tested using CR_ONCE. The idea is to load the command into the container and give it executable permissions. Then, since the project itself has dependencies, you need to download the dependencies and store them in the specified location.

Git clone projects are only managed by specifying the path to load files, so you can use git clone directly.

The ideal solution is that the CR command itself does not rely on strange things, can be directly run in CI, and then through the extension module solution, which is dynamic loading dynamic link library or other modules to introduce the extension function, such as SDL2, and then module management also built-in a command to do, automatic download, Automated dependency maintenance…. For now, Calcit lacks functionality, so that’s all for now.

Going back to GitHub Actions, I need to load the binaries into the container. I tried two solutions,

Dockerfile scheme (not adopted)

First of all, making is to support the Actions inside the use of containers, https://docs.github.com/en/fr… Following the tutorial, I wrote a Dockerfile to wrap a container that contains cr_once. After debugging a few errors, I was able to run normally in the container.

But this solution gave me some insight into the limitations of the GitHub Actions environment, or the limitations of the Docker container itself, where commands are defined to run inside the container. Then the operation of the container is completed, and there is no influence on the external environment (I do not know how to match to expose the ability). So I tried Git Clone in my project, and I was able to access Git Clone inside the container, but when the container was finished, I could not access Git Clone outside the container. This means that the final run is internal to the container, and it is difficult for me to do various configurations outside of the container. Logic is not natural.

The setup program

Then I go to take a look at how the other programming languages, such as Nim is a binary executable files: https://github.com/jiro4989/s… The general idea is to use the Node.js script Action, download and install NIM, and get an environment. Look at the idea of NodeJS, also like this, directly download to the current environment to install.

Then I change train of thought is correct, and eventually get a script like this: https://github.com/calcit-lan…

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: wget
      run: mkdir ci-bin/ && wget -O ci-bin/cr_once http://repo.calcit-lang.org/binaries/linux/cr_once
    - name: "permission"
      run: chmod +x ci-bin/cr_once

    - name: "prepare modules"
      run: mkdir -p ~/.config/calcit/modules/ && cd ~/.config/calcit/modules/ && echo 'no deps'

    - name: "test"
      run: env=ci ./ci-bin/cr_once

This step is:

  • throughwgetdownloadcr_onceExecutable file corresponding to the Linux environment,
  • Create a directory for the modules used by calcit-runner, and clone the code into it if there are any dependent modules.
  • Run the executable, adding one as neededenv=ciOf environment variables.

The final operation is also successful, and more convenient to adapt according to the need to customize. Meet the present need.

other

When I tried, there was nothing in Docker using the Ubuntu default system, but GitHub provided a convenient container, and git, wget and other commands were in it, which made things easier. In principle, installing the cr_once step can be pulled out as an Action, which is much easier to use and easier to upgrade later by simply increasing the version number. That’s for now.