diff --git a/.github/actions/0_setup/action.yml b/.github/actions/0_setup/action.yml new file mode 100644 index 000000000..24bcf9db8 --- /dev/null +++ b/.github/actions/0_setup/action.yml @@ -0,0 +1,23 @@ +name: 'Setup Environment' +description: 'Setup Environment' + +inputs: + qt-version: + description: 'Qt Version' + required: false + default: '5.15.2' + +runs: + using: "composite" + steps: + - name: Setup MSVC + uses: ilammy/msvc-dev-cmd@v1 + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + cache: true + version: ${{ inputs.qt-version }} + - name: Install dependencies + shell: bash + run: | + bash scripts/${{ runner.os }}/0_setup_env.sh --dont_install_qt \ No newline at end of file diff --git a/.github/actions/1_build/action.yml b/.github/actions/1_build/action.yml new file mode 100644 index 000000000..e0d0f7b0a --- /dev/null +++ b/.github/actions/1_build/action.yml @@ -0,0 +1,56 @@ +name: 'Build' +description: 'Build' + +inputs: + cache-path: + description: 'Directory to cache after build' + required: false + default: '' + cache-key: + description: 'Cache key' + required: false + default: '' + build-option: + description: 'Build option' + required: false + default: '' + nightly: + description: 'Nightly build' + required: false + type: boolean + default: false + +runs: + using: "composite" + steps: + - name: Setup env variables + id: envs + shell: bash + run: | + if [ "${{ inputs.build-option }}" != "" ]; then + echo "build_option=--${{ inputs.build-option }}" >> $GITHUB_OUTPUT + echo "artifact_suffix=_${{ inputs.build-option }}" >> $GITHUB_OUTPUT + else + echo "build_option=" >> $GITHUB_OUTPUT + echo "artifact_suffix=" >> $GITHUB_OUTPUT + fi + if [ "${{ inputs.nightly }}" = "true" ]; then + echo "nightly=--nightly" >> $GITHUB_OUTPUT + else + echo "nightly=" >> $GITHUB_OUTPUT + fi + - name: Cache external libraries sources + id: cache-ext-libs + if: ${{ inputs.cache-path != '' }} + uses: actions/cache@v3 + with: + path: ${{ inputs.cache-path }} + key: ${{ runner.os }}-${{ inputs.cache-key }} + - name: Ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ runner.os }}-${{ github.ref }}-${{ inputs.build-option }} + - name: Configure and Build + shell: bash + run: | + bash scripts/${{ runner.os }}/1_build.sh ${{ steps.envs.outputs.build_option }} ${{ steps.envs.outputs.nightly }} --ccache \ No newline at end of file diff --git a/.github/actions/2_deploy/action.yml b/.github/actions/2_deploy/action.yml new file mode 100644 index 000000000..69b582081 --- /dev/null +++ b/.github/actions/2_deploy/action.yml @@ -0,0 +1,65 @@ +name: 'Deploy' +description: 'Deploy' + +inputs: + mac-certificate: + description: 'MacOS Certificate' + required: false + default: '' + mac-certificate-id: + description: 'MacOS Certificate ID' + required: false + default: '' + mac-certificate-pssw: + description: 'MacOS Certificate Password' + required: false + mac-notarization-user: + description: 'MacOS Notarization User' + required: false + default: '' + mac-notarization-team: + description: 'MacOS Notarization Team' + required: false + default: '' + mac-notarization-pssw: + description: 'MacOS Notarization Password' + required: false + default: '' + win-certificate: + description: 'Windows Certificate' + required: false + default: '' + win-certificate-pssw: + description: 'Windows Certificate Password' + required: false + default: '' + +runs: + using: "composite" + steps: + - name: Set Notarization settings + id: notarization + shell: bash + run: | + if [ "${{ inputs.mac-notarization-user }}" != "" ]; then + echo "not_setting=--notarization_user='${{ inputs.mac-notarization-user }}' --notarization_team='${{ inputs.mac-notarization-team }}' --notarization_pssw='${{ inputs.mac-notarization-pssw }}'" >> $GITHUB_OUTPUT + else + echo "not_setting=" >> $GITHUB_OUTPUT + fi + - name: Set CodeSign Certificate macOS + if: ${{ runner.os == 'macOS' && inputs.mac-certificate != ''}} + uses: apple-actions/import-codesign-certs@v2 + with: + p12-file-base64: ${{ inputs.mac-certificate }} + p12-password: ${{ inputs.mac-certificate-pssw }} + - name: Set CodeSign Certificate Windows + shell: powershell + if: ${{ runner.os == 'Windows' && inputs.win-certificate != '' }} + run: | + New-Item -ItemType directory -Path certificate + Set-Content -Path certificate\certificate.txt -Value '${{ inputs.win-certificate }}' + certutil -decode certificate\certificate.txt certificate\certificate.pfx + - name: Deploy + shell: bash + run: | + bash scripts/${{ runner.os }}/2_deploy.sh --cert_pssw='${{ inputs.win-certificate-pssw }}' --cert_id='${{ inputs.mac-certificate-id }}' ${{ steps.notarization.outputs.not_setting }} \ No newline at end of file diff --git a/.github/workflows/BuildMeshLab.yml b/.github/workflows/BuildMeshLab.yml index 6f9327af4..97333163c 100644 --- a/.github/workflows/BuildMeshLab.yml +++ b/.github/workflows/BuildMeshLab.yml @@ -6,6 +6,7 @@ on: env: QT_VERSION: 5.15.2 MAC_CERT: ${{secrets.MACOS_CERT_ID}} + MAC_CERT_PSSW: ${{secrets.MACOS_CERTIFICATE_PSSW}} WIN_CERT: ${{secrets.WIN_CERTIFICATE}} jobs: @@ -21,29 +22,8 @@ jobs: - uses: actions/checkout@v3 with: submodules: recursive - - name: Setup MSVC - uses: ilammy/msvc-dev-cmd@v1 - - name: Set CodeSign Certificate macOS - if: runner.os == 'macOS' && env.MAC_CERT != null - uses: apple-actions/import-codesign-certs@v2 - with: - p12-file-base64: ${{ secrets.MACOS_CERTIFICATE }} - p12-password: ${{ secrets.MACOS_CERTIFICATE_PSSW }} - - name: Set CodeSign Certificate Windows - if: runner.os == 'Windows' && env.WIN_CERT != null - run: | - New-Item -ItemType directory -Path certificate - Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_CERTIFICATE }}' - certutil -decode certificate\certificate.txt certificate\certificate.pfx - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - cache: true - version: ${{ env.QT_VERSION }} - - name: Install dependencies - shell: bash - run: | - bash scripts/${{ runner.os }}/0_setup_env.sh --dont_install_qt + - name: Setup Environment + uses: ./.github/actions/0_setup - name: Setup env variables id: envs shell: bash @@ -53,24 +33,21 @@ jobs: else echo "artifact_suffix=" >> $GITHUB_OUTPUT fi - - name: Cache external libraries sources - id: cache-ext-libs - uses: actions/cache@v3 + - name: Build + uses: ./.github/actions/1_build with: - path: src/external/downloads/* - key: ${{ runner.os }}-external-libraries - - name: Ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ runner.os }}-${{ github.ref }}-${{ matrix.precision }} - - name: Configure and Build - shell: bash - run: | - bash scripts/${{ runner.os }}/1_build.sh --${{ matrix.precision }} --nightly --ccache + cache-path: src/external/downloads/* + cache-key: external-libraries + build-option: ${{matrix.precision}} + nightly: true - name: Deploy - shell: bash - run: | - bash scripts/${{ runner.os }}/2_deploy.sh --cert_pssw='${{ secrets.WIN_CERTIFICATE_PSSW }}' --cert_id='${{ secrets.MACOS_CERT_ID }}' + uses: ./.github/actions/2_deploy + with: + mac-certificate: ${{ secrets.MACOS_CERTIFICATE }} + mac-certificate-id: ${{ secrets.MACOS_CERT_ID }} + mac-certificate-pssw: ${{ secrets.MACOS_CERTIFICATE_PSSW }} + win-certificate: ${{ secrets.WIN_CERTIFICATE }} + win-certificate-pssw: ${{ secrets.WIN_CERTIFICATE_PSSW }} - name: Upload MeshLab Portable uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/CreateRelease.yml b/.github/workflows/CreateRelease.yml index d4b541f3d..ea091dc19 100644 --- a/.github/workflows/CreateRelease.yml +++ b/.github/workflows/CreateRelease.yml @@ -41,29 +41,8 @@ jobs: with: submodules: recursive ref: main - - name: Setup MSVC - uses: ilammy/msvc-dev-cmd@v1 - - name: Set CodeSign Certificate macOS - if: runner.os == 'macOS' - uses: apple-actions/import-codesign-certs@v2 - with: - p12-file-base64: ${{ secrets.MACOS_CERTIFICATE }} - p12-password: ${{ secrets.MACOS_CERTIFICATE_PSSW }} - - name: Set CodeSign Certificate Windows - if: runner.os == 'Windows' - run: | - New-Item -ItemType directory -Path certificate - Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_CERTIFICATE }}' - certutil -decode certificate\certificate.txt certificate\certificate.pfx - - name: Install Qt - uses: jurplel/install-qt-action@v3 - with: - cache: true - version: ${{ env.QT_VERSION }} - - name: Install dependencies - shell: bash - run: | - bash scripts/${{ runner.os }}/0_setup_env.sh --dont_install_qt + - name: Setup Environment + uses: ./.github/actions/0_setup - name: Setup env variables id: envs shell: bash @@ -73,24 +52,23 @@ jobs: else echo "artifact_suffix=" >> $GITHUB_OUTPUT fi - - name: Cache external libraries sources - id: cache-ext-libs - uses: actions/cache@v3 + - name: Build + uses: ./.github/actions/1_build with: - path: src/external/downloads/* - key: ${{ runner.os }}-external-libraries - - name: Ccache - uses: hendrikmuhs/ccache-action@v1.2 - with: - key: ${{ runner.os }}-${{ github.ref }}-${{ matrix.precision }} - - name: Configure and Build - shell: bash - run: | - bash scripts/${{ runner.os }}/1_build.sh --${{ matrix.precision }} --ccache + cache-path: src/external/downloads/* + cache-key: external-libraries + build-option: ${{matrix.precision}} - name: Deploy - shell: bash - run: | - bash scripts/${{ runner.os }}/2_deploy.sh --cert_pssw='${{ secrets.WIN_CERTIFICATE_PSSW }}' --cert_id='${{ secrets.MACOS_CERT_ID }}' --notarization_user='${{ secrets.MACOS_NOTARIZATION_USER }}' --notarization_team='${{ secrets.MACOS_NOTARIZATION_TEAM_ID }}' --notarization_pssw='${{ secrets.MACOS_NOTARIZATION_PSSW }}' + uses: ./.github/actions/2_deploy + with: + mac-certificate: ${{ secrets.MACOS_CERTIFICATE }} + mac-certificate-id: ${{ secrets.MACOS_CERT_ID }} + mac-certificate-pssw: ${{ secrets.MACOS_CERTIFICATE_PSSW }} + mac-notarization-user: ${{ secrets.MACOS_NOTARIZATION_USER }} + mac-notarization-team: ${{ secrets.MACOS_NOTARIZATION_TEAM_ID }} + mac-notarization-pssw: ${{ secrets.MACOS_NOTARIZATION_PSSW }} + win-certificate: ${{ secrets.WIN_CERTIFICATE }} + win-certificate-pssw: ${{ secrets.WIN_CERTIFICATE_PSSW }} - name: Upload MeshLab Portable uses: actions/upload-artifact@v3 with: