Skip to content

Commit

Permalink
slow progress
Browse files Browse the repository at this point in the history
  • Loading branch information
gafferongames committed Dec 24, 2023
1 parent fb26300 commit a0ce013
Show file tree
Hide file tree
Showing 26 changed files with 21 additions and 3,854 deletions.
26 changes: 1 addition & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,40 +23,16 @@ jobs:
- name: Setup premake
uses: abel0b/setup-premake@v1

## Linux-specific build setup
# Try to get our previously built mbedtls from the cache
- name: Cache mbedtls (Linux)
if: runner.os == 'Linux'
id: cache-mbedtls
uses: actions/cache@v2
with:
key: ${{ runner.os }}-mbedtls-${{ env.MBEDTLS_VERSION }}
path: ~/mbedtls_install

# If we can't get mbedtls from cache, download it and build it from source (and then it'll be cached
# when this build succeeds.) This is needed because Ubuntu 20.04 (latest GH hosted runner) only supports
# mbedtls 2 -- we can replace all this with a `sudo apt-get install libmbedtls-dev` or something similar
# once GH's runners are on a newer Ubuntu with mbedtls support.
- name: Build mbedtls when not cached (Linux)
if: runner.os == 'Linux' && steps.cache-mbedtls.outputs.cache-hit != 'true'
run: |
wget -nv https://github.com/ARMmbed/mbedtls/archive/refs/tags/v${MBEDTLS_VERSION}.tar.gz -O mbedtls.tgz
tar zxf mbedtls.tgz
cd mbedtls-${MBEDTLS_VERSION}
make install DESTDIR=$HOME/mbedtls_install
# Install libsodium from apt and configure the compiler to look for our local mbedtls
- name: Setup (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install libsodium-dev
echo CPATH=$HOME/mbedtls_install/include >> $GITHUB_ENV
echo LIBRARY_PATH=$HOME/mbedtls_install/lib >> $GITHUB_ENV
## MacOS-specific build setup
- name: Setup (MacOS)
if: runner.os == 'MacOS'
run: brew install libsodium mbedtls@3
run: brew install libsodium

## Linux & MacOS-specific build steps
# Build with premake + make
Expand Down
16 changes: 7 additions & 9 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ You can now build the library and run individual test programs as you would for

First, download and install [premake 5](https://premake.github.io/download.html).

Next, install libsodium and mbedtls.
Next, install libsodium

On MacOS X, this can be done most easily with `brew install libsodium mbedtls`. If you don't have Brew, you can install it from <http://brew.sh>.
On MacOS X, this can be done most easily with `brew install libsodium`. If you don't have Brew, you can install it from <http://brew.sh>.

On Linux, depending on your particular distribution there may be prebuilt packages for libsodium and mbedtls, or you may have to build from source from here [libsodium](https://github.com/jedisct1/libsodium/releases) and here [mbedtls](https://github.com/ARMmbed/mbedtls). Make sure you install the 3.x version of mbedtls as the 2.x & 1.x version will not work with yojimbo.
On Linux, depending on your particular distribution there may be prebuilt packages for libsodium, or you may have to build from source from here [libsodium](https://github.com/jedisct1/libsodium/releases).

Now go to the command line under the yojimbo directory and enter:

Expand Down Expand Up @@ -63,17 +63,15 @@ IMPORTANT: The premake docker action takes a long time initially, because it has

4. Download, build and install libsodium

5. Download, build and install mbedtls
5. Build release version of yojimbo, run tests

6. Build release version of yojimbo, run tests
6. If all tests pass, clean everything and copy the yojimbo server to the /home dir

7. If all tests pass, clean everything and copy the yojimbo server to the /home dir

8. When the Docker container is run, start the yojimbo server /home/server on UDP port 40000.
7. When the Docker container is run, start the yojimbo server /home/server on UDP port 40000.

For details see docker/Dockerfile and the premake5.lua file with commands that build and run the container instance.

What's most impressive is that if no dependencies have changed, the numbered steps above are precached as intermediate Docker instances are not rebuilt unless necessary. For example, if you have already downloaded and installed wget, g++, libsodium, premake5, mbedtls and you run "premake5 docker" again, these steps are skipped.
What's most impressive is that if no dependencies have changed, the numbered steps above are precached as intermediate Docker instances are not rebuilt unless necessary. For example, if you have already downloaded and installed wget, g++, libsodium, premake5 and you run "premake5 docker" again, these steps are skipped.

Try it yourself by running "premake5 docker" once (it should build everything), then run it again. It will go straight to the server running on port 40000. Similarly, if you change some yojimbo source it automatically rebuilds yojimbo server and runs tests before starting the server. Impressive!

Expand Down
Loading

0 comments on commit a0ce013

Please sign in to comment.