FreeCAD

Форк
0
/
sub_buildMacOSCondaApple.yml 
167 строк · 6.7 Кб
1
# SPDX-License-Identifier: LGPL-2.1-or-later
2
# ***************************************************************************
3
# *                                                                         *
4
# *   Copyright (c) 2023 0penBrain.                                         *
5
# *                                                                         *
6
# *   This file is part of FreeCAD.                                         *
7
# *                                                                         *
8
# *   FreeCAD is free software: you can redistribute it and/or modify it    *
9
# *   under the terms of the GNU Lesser General Public License as           *
10
# *   published by the Free Software Foundation, either version 2.1 of the  *
11
# *   License, or (at your option) any later version.                       *
12
# *                                                                         *
13
# *   FreeCAD is distributed in the hope that it will be useful, but        *
14
# *   WITHOUT ANY WARRANTY; without even the implied warranty of            *
15
# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      *
16
# *   Lesser General Public License for more details.                       *
17
# *                                                                         *
18
# *   You should have received a copy of the GNU Lesser General Public      *
19
# *   License along with FreeCAD. If not, see                               *
20
# *   <https://www.gnu.org/licenses/>.                                      *
21
# *                                                                         *
22
# ***************************************************************************
23

24
# This is a build and test workflow for CI of FreeCAD.
25
# This workflow aims at building and testing FreeCAD on a Conda environment on macOS.
26

27
name: Build macOS 13 (Apple Silicon)
28
on:
29
  workflow_call:
30
    inputs:
31
      artifactBasename:
32
        type: string
33
        required: true
34
      testOnBuildDir:
35
        default: false
36
        type: boolean
37
        required: false
38
      allowedToFail:
39
        default: false
40
        type: boolean
41
        required: false
42
    outputs:
43
      reportFile:
44
        value: ${{ jobs.Build.outputs.reportFile }}
45

46
jobs:
47
  Build:
48
    runs-on: macos-13-xlarge
49
    continue-on-error: ${{ inputs.allowedToFail }}
50
    env:
51
      CCACHE_DIR: ${{ github.workspace }}/ccache
52
      CCACHE_CONFIGPATH: ${{ github.workspace }}/ccache/config
53
      CCACHE_MAXSIZE: 1G
54
      CCACHE_COMPILERCHECK: "%compiler% -dumpfullversion -dumpversion" # default:mtime
55
      CCACHE_COMPRESS: true
56
      CCACHE_COMPRESSLEVEL: 1
57
      CC: arm64-apple-darwin20.0.0-clang
58
      CXX: arm64-apple-darwin20.0.0-clang++
59
      builddir: ${{ github.workspace }}/build/release/
60
      logdir: /tmp/logs/
61
      reportdir: /tmp/report/
62
      reportfilename: ${{ inputs.artifactBasename }}-report.md
63
    defaults:
64
      run:
65
        shell: bash -l {0}
66
    outputs:
67
      reportFile: ${{ steps.Init.outputs.reportFile }}
68

69
    steps:
70
      - name: Checking out source code
71
        uses: actions/checkout@v4
72
        with:
73
          submodules: true
74
      - name: Setup Miniconda
75
        uses: conda-incubator/setup-miniconda@v3
76
        with:
77
          activate-environment: .conda/freecad
78
          environment-file: conda/conda-env.yaml
79
          channels: conda-forge,defaults
80
          channel-priority: true
81
          miniforge-version: latest
82
      - name: Install FreeCAD dependencies
83
        run: |
84
          ./conda/setup-environment.sh
85
      - name: Set Environment Variables
86
        run: |
87
          echo "CC=$CC" >> "$GITHUB_ENV"
88
          echo "CXX=$CXX" >> "$GITHUB_ENV"
89
      - name: Make needed directories, files and initializations
90
        id: Init
91
        run: |
92
          mkdir -p ${{ env.CCACHE_DIR }}
93
          mkdir -p ${{ env.CCACHE_CONFIGPATH }}
94
          mkdir -p ${{ env.builddir }}
95
          mkdir -p ${{ env.logdir }}
96
          mkdir -p ${{ env.reportdir }}
97
          echo "reportFile=${{ env.reportfilename }}" >> $GITHUB_OUTPUT
98
      - name: Generate cache key
99
        id: genCacheKey
100
        uses: ./.github/workflows/actions/macos/generateCacheKey
101
        with:
102
          compiler: ${{ env.CXX }}
103
      - name: Restore Compiler Cache
104
        uses: actions/cache@v4
105
        with:
106
          save-always: true
107
          path: ${{ env.CCACHE_DIR }}
108
          key: FC-${{ steps.genCacheKey.outputs.cacheKey }}-${{ github.ref }}-${{ github.run_id }}
109
          restore-keys: |
110
            FC-${{ steps.genCacheKey.outputs.cacheKey }}-${{ github.ref }}-
111
            FC-${{ steps.genCacheKey.outputs.cacheKey }}-
112
      - name: Print CCache statistics before build, reset stats and print config
113
        run: |
114
          ccache -s
115
          ccache -z
116
          ccache -p
117
      - name: CMake Configure
118
        run: |
119
          mamba run --live-stream -p .conda/freecad cmake --preset conda-macos-release -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/.conda/freecad/opt/freecad
120
      - name: CMake Build
121
        run: |
122
          mamba run --live-stream -p .conda/freecad cmake --build build/release
123
      - name: Print ccache statistics after Build
124
        run: |
125
          ccache -s
126
      - name: FreeCAD CLI tests on build dir
127
        if: inputs.testOnBuildDir
128
        timeout-minutes: 10
129
        uses: ./.github/workflows/actions/runPythonTests
130
        with:
131
          testDescription: "CLI tests on build dir"
132
          testCommand: ${{ env.builddir }}/bin/FreeCADCmd -t 0
133
          logFile: ${{ env.logdir }}TestCLIBuild.log
134
          reportFile: ${{env.reportdir}}${{ env.reportfilename }}
135
      - name: C++ tests
136
        timeout-minutes: 1
137
        uses: ./.github/workflows/actions/runCPPTests/runAllTests
138
        with:
139
          reportdir: ${{ env.reportdir }}
140
          builddir: ${{ env.builddir }}
141
          reportFile: ${{ env.reportdir }}${{ env.reportfilename }}
142
      - name: CMake Install
143
        run: |
144
          mamba run --live-stream -p .conda/freecad cmake --install build/release
145
      - name: FreeCAD CLI tests on install
146
        timeout-minutes: 10
147
        uses: ./.github/workflows/actions/runPythonTests
148
        with:
149
          testDescription: "CLI tests on install"
150
          testCommand: ${{ github.workspace }}/.conda/freecad/opt/freecad/bin/FreeCADCmd -t 0
151
          logFile: ${{ env.logdir }}TestCLIInstall.log
152
          reportFile: ${{env.reportdir}}${{ env.reportfilename }}
153
      - name: Upload logs
154
        if: always()
155
        uses: actions/upload-artifact@v4
156
        with:
157
          name: ${{ inputs.artifactBasename }}-Logs
158
          path: |
159
            ${{ env.logdir }}
160
            /var/crash/*FreeCAD*
161
      - name: Upload report
162
        if: always()
163
        uses: actions/upload-artifact@v4
164
        with:
165
          name: ${{ env.reportfilename }}
166
          path: |
167
            ${{env.reportdir}}${{ env.reportfilename }}
168

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.