Blog
Freebsd Actions Update

FreeBSD Actions update

📅 2023/11/01

Recently, the GitHub Actions vmactions/freebsd-vm that we have been using to build FreeBSD x64 binaries is not working properly on our new CI system. We suggest that all projects requiring the compilation of FreeBSD x64 binaries migrate to cross-platform-actions/action.

This is how you can migrate your project:

- uses: vmactions/freebsd-vm@v0
+ uses: cross-platform-actions/action@v0.21.0
  env:
     DEBUG: napi:*
-    RUSTUP_HOME: /usr/local/rustup
-    CARGO_HOME: /usr/local/cargo
     RUSTUP_IO_THREADS: 1
  with:
-    envs: DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS
-    usesh: true
-    mem: 3000
+    operating_system: freebsd
+    version: '13.2'
+    memory: 13G
+    cpu_count: 3
+    environment_variables: 'DEBUG RUSTUP_IO_THREADS'
+    shell: bash
-    prepare: |
-      pkg install -y -f curl node libnghttp2 npm
-      npm install -g yarn --ignore-scripts
-      curl https://sh.rustup.rs -sSf --output rustup.sh
-      sh rustup.sh -y --profile minimal --default-toolchain beta
-      export PATH="/usr/local/cargo/bin:$PATH"
-      echo "~~~~ rustc --version ~~~~"
-      rustc --version
-      echo "~~~~ node -v ~~~~"
-      node -v
-      echo "~~~~ yarn --version ~~~~"
-      yarn --version
     run:
+      sudo pkg install -y -f curl node libnghttp2 npm
+      sudo npm install -g yarn --ignore-scripts
+      curl https://sh.rustup.rs -sSf --output rustup.sh
+      sh rustup.sh -y --profile minimal --default-toolchain beta
+      source "$HOME/.cargo/env"
+      echo "~~~~ rustc --version ~~~~"
+      rustc --version
+      echo "~~~~ node -v ~~~~"
+      node -v
+      echo "~~~~ yarn --version ~~~~"
+      yarn --version
+      pwd
+      ls -lah
+      whoami
+      env
+      freebsd-version
+      yarn install
+      yarn build
+      rm -rf node_modules
+      rm -rf target
+      rm -rf .yarn/cache

Here is a pull request that you can refer to as well: https://github.com/napi-rs/package-template/pull/343 (opens in a new tab)