summary refs log tree commit diff
path: root/.github/workflows/build_freebsd.yml
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2024-06-16 10:35:45 +0300
committerWlodekM <[email protected]>2024-06-16 10:35:45 +0300
commitabef6da56913f1c55528103e60a50451a39628b1 (patch)
treeb3c8092471ecbb73e568cd0d336efa0e7871ee8d /.github/workflows/build_freebsd.yml
initial commit
Diffstat (limited to '.github/workflows/build_freebsd.yml')
-rw-r--r--.github/workflows/build_freebsd.yml80
1 files changed, 80 insertions, 0 deletions
diff --git a/.github/workflows/build_freebsd.yml b/.github/workflows/build_freebsd.yml
new file mode 100644
index 0000000..e6eea21
--- /dev/null
+++ b/.github/workflows/build_freebsd.yml
@@ -0,0 +1,80 @@
+name: Build latest (FreeBSD)
+# trigger via either push to selected branches or on manual run
+on:
+  push:
+    branches:
+      - main
+      - master
+  workflow_dispatch:
+
+concurrency:
+  group: ${{ github.ref }}-freebsd
+  cancel-in-progress: true
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    container:
+      image: empterdose/freebsd-cross-build:11.4
+    steps:
+      - uses: actions/checkout@v4
+      - name: Install prerequisites
+        run: apk add bash wget
+      - name: Retrieve OpenGL and X11 dev files (64 bit)
+        run: |
+          mkdir src/freebsd64
+          cd src/freebsd64
+          wget https://github.com/ClassiCube/rpi-compiling-stuff/raw/main/freebsd64.zip
+          unzip freebsd64.zip
+      - name: Retrieve OpenGL and X11 dev files (32 bit)
+        run: |
+          mkdir src/freebsd32
+          cd src/freebsd32
+          wget https://github.com/ClassiCube/rpi-compiling-stuff/raw/main/freebsd32.zip
+          unzip freebsd32.zip  
+      - name: Compile FreeBSD builds
+        id: compile
+        shell: bash
+        env: 
+          COMMON_FLAGS: "-O1 -s -fno-stack-protector -fno-math-errno -Qn"
+          PLAT32_FLAGS: "-fno-pie -fvisibility=hidden -fcf-protection=none -rdynamic -DCC_BUILD_ICON -I freebsd32/include -L freebsd32/lib"
+          PLAT64_FLAGS: "-fno-pie -fvisibility=hidden -fcf-protection=none -rdynamic -DCC_BUILD_ICON -I freebsd64/include -L freebsd64/lib"
+        run: |
+          apk add curl
+          LATEST_FLAG=-DCC_COMMIT_SHA=\"${GITHUB_SHA::9}\"
+          
+          cd src
+          i386-freebsd11-clang *.c ${{ env.COMMON_FLAGS }} ${{ env.PLAT32_FLAGS }} $LATEST_FLAG -o cc-fbsd32-gl1 -lm -lpthread -lX11 -lXi -lGL -lexecinfo
+          x86_64-freebsd11-clang *.c ${{ env.COMMON_FLAGS }} ${{ env.PLAT64_FLAGS }} $LATEST_FLAG -o cc-fbsd64-gl1 -lm -lpthread -lX11 -lXi -lGL -lexecinfo
+
+
+      # otherwise notify_failure doesn't work
+      - name: Install curl when necessary
+        if: ${{ always() && steps.compile.outcome == 'failure' }}
+        run: apk add curl
+
+      - uses: ./.github/actions/notify_failure
+        if: ${{ always() && steps.compile.outcome == 'failure' }}
+        with:
+          NOTIFY_MESSAGE: 'Failed to compile FreeBSD build(s)'
+          WEBHOOK_URL: '${{ secrets.WEBHOOK_URL }}'
+          
+          
+      - uses: ./.github/actions/upload_build
+        if: ${{ always() && steps.compile.outcome == 'success' }}
+        with:
+          SOURCE_FILE: 'src/cc-fbsd32-gl1'
+          DEST_NAME: 'ClassiCube-FreeBSD-32'
+          
+      - uses: ./.github/actions/upload_build
+        if: ${{ always() && steps.compile.outcome == 'success' }}
+        with:
+          SOURCE_FILE: 'src/cc-fbsd64-gl1'
+          DEST_NAME: 'ClassiCube-FreeBSD-64'
+          
+          
+      - uses: ./.github/actions/notify_success
+        if: ${{ always() && steps.compile.outcome == 'success' }}
+        with:
+          DESTINATION_URL: '${{ secrets.NOTIFY_URL }}'
+          WORKFLOW_NAME: 'freebsd'
\ No newline at end of file