summary refs log tree commit diff
path: root/.github/workflows/build_freebsd.yml
blob: e6eea21026935ac9ac9cf870af7482d7f62336f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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'