From: Pasukhin Dmitry Date: Wed, 30 Jul 2025 20:07:08 +0000 (+0100) Subject: Testing - Create occt artefact action (#658) X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=cac9d357e8cd009a0e65afa4652297567be5b874;p=occt.git Testing - Create occt artefact action (#658) - Created custom upload-artifacts and download-artifacts actions with platform-specific logic - Updated all existing workflows to use the new custom artifact actions - Added extraction steps for tar.gz archives in the test summary workflow --- diff --git a/.github/actions/build-occt/action.yml b/.github/actions/build-occt/action.yml index b503d2ac9a..bdd11d9085 100644 --- a/.github/actions/build-occt/action.yml +++ b/.github/actions/build-occt/action.yml @@ -78,7 +78,7 @@ runs: shell: bash - name: Upload install directory - uses: actions/upload-artifact@v4.6.2 + uses: ./.github/actions/upload-artifacts with: name: ${{ inputs.artifact-name }} path: install diff --git a/.github/actions/build-sample-csharp/action.yml b/.github/actions/build-sample-csharp/action.yml index c73bdf8f00..1f02efb0ad 100644 --- a/.github/actions/build-sample-csharp/action.yml +++ b/.github/actions/build-sample-csharp/action.yml @@ -13,7 +13,7 @@ runs: using: "composite" steps: - name: Download OCCT installation - uses: actions/download-artifact@v4.3.0 + uses: ./.github/actions/download-artifacts with: name: ${{ inputs.install-artifact-name }} path: occt-install diff --git a/.github/actions/build-sample-mfc/action.yml b/.github/actions/build-sample-mfc/action.yml index b16465dde0..e4103b2415 100644 --- a/.github/actions/build-sample-mfc/action.yml +++ b/.github/actions/build-sample-mfc/action.yml @@ -13,7 +13,7 @@ runs: using: "composite" steps: - name: Download OCCT installation - uses: actions/download-artifact@v4.3.0 + uses: ./.github/actions/download-artifacts with: name: ${{ inputs.install-artifact-name }} path: occt-install diff --git a/.github/actions/build-sample-qt/action.yml b/.github/actions/build-sample-qt/action.yml index 5133fe5d18..c910d6829d 100644 --- a/.github/actions/build-sample-qt/action.yml +++ b/.github/actions/build-sample-qt/action.yml @@ -17,7 +17,7 @@ runs: using: "composite" steps: - name: Download OCCT installation - uses: actions/download-artifact@v4.3.0 + uses: ./.github/actions/download-artifacts with: name: ${{ inputs.install-artifact-name }} path: occt-install diff --git a/.github/actions/build-tinspector/action.yml b/.github/actions/build-tinspector/action.yml index a3891605df..bade453104 100644 --- a/.github/actions/build-tinspector/action.yml +++ b/.github/actions/build-tinspector/action.yml @@ -17,7 +17,7 @@ runs: using: "composite" steps: - name: Download OCCT installation - uses: actions/download-artifact@v4.3.0 + uses: ./.github/actions/download-artifacts with: name: ${{ inputs.install-artifact-name }} path: occt-install diff --git a/.github/actions/download-artifacts/action.yml b/.github/actions/download-artifacts/action.yml new file mode 100644 index 0000000000..693aa94419 --- /dev/null +++ b/.github/actions/download-artifacts/action.yml @@ -0,0 +1,73 @@ +name: 'Download Platform Artifacts' +description: 'Download and extract artifacts with proper file permissions and symlinks (cross-platform)' +inputs: + name: + description: 'Artifact name' + required: true + path: + description: 'Path to extract to (optional)' + required: false + default: '.' + +runs: + using: 'composite' + steps: + # For Windows, use standard GitHub action - no symlink issues + - name: Download artifacts (Windows) + if: runner.os == 'Windows' + uses: actions/download-artifact@v4.3.0 + with: + name: ${{ inputs.name }} + path: ${{ inputs.path }} + + # For Linux/Unix, use custom workaround to handle symlinks properly + - name: Download archive (Unix) + if: runner.os != 'Windows' + uses: actions/download-artifact@v4.3.0 + with: + name: ${{ inputs.name }} + path: ./download-temp + + - name: Extract archive (Unix) + if: runner.os != 'Windows' + shell: bash + run: | + EXTRACT_PATH="${{ inputs.path }}" + ARCHIVE_FILE="./download-temp/${{ inputs.name }}.tar.gz" + + if [ ! -f "$ARCHIVE_FILE" ]; then + echo "Error: Archive file $ARCHIVE_FILE not found" + ls -la ./download-temp/ + exit 1 + fi + + echo "Extracting $ARCHIVE_FILE to $EXTRACT_PATH" + + # Extract and handle directory structure properly + if [ "$EXTRACT_PATH" != "." ]; then + # Extract to temp location first + mkdir -p temp-extract + tar -xzf "$ARCHIVE_FILE" -C temp-extract + + # Move the extracted content to the desired path + if [ -d "temp-extract/install" ]; then + # Remove target directory if it exists to avoid nesting + rm -rf "$EXTRACT_PATH" + mv "temp-extract/install" "$EXTRACT_PATH" + else + # If archive doesn't contain install/, move everything + mkdir -p "$EXTRACT_PATH" + mv temp-extract/* "$EXTRACT_PATH/" + fi + + # Clean up temp directory + rm -rf temp-extract + else + tar -xzf "$ARCHIVE_FILE" -C "$EXTRACT_PATH" + fi + + echo "Extraction complete" + ls -la "$EXTRACT_PATH" + + # Clean up temporary download directory + rm -rf ./download-temp \ No newline at end of file diff --git a/.github/actions/retest-failures/action.yml b/.github/actions/retest-failures/action.yml index 80b2506389..d18673a488 100644 --- a/.github/actions/retest-failures/action.yml +++ b/.github/actions/retest-failures/action.yml @@ -118,7 +118,7 @@ runs: - name: Download and extract install directory if: steps.check_failures.outputs.failed_count > 0 - uses: actions/download-artifact@v4.3.0 + uses: ./.github/actions/download-artifacts with: name: ${{ inputs.install-artifact-name }} path: install diff --git a/.github/actions/run-gtest/action.yml b/.github/actions/run-gtest/action.yml index 9b8fc4af15..44aab0ead6 100644 --- a/.github/actions/run-gtest/action.yml +++ b/.github/actions/run-gtest/action.yml @@ -25,7 +25,7 @@ runs: using: "composite" steps: - name: Download and extract install directory - uses: actions/download-artifact@v4.3.0 + uses: ./.github/actions/download-artifacts with: name: ${{ inputs.install-artifact-name }} path: install diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml index 3d9f74f065..1d45559fcb 100644 --- a/.github/actions/run-tests/action.yml +++ b/.github/actions/run-tests/action.yml @@ -53,7 +53,7 @@ runs: shell: bash - name: Download and extract install directory - uses: actions/download-artifact@v4.3.0 + uses: ./.github/actions/download-artifacts with: name: ${{ inputs.install-artifact-name }} path: install diff --git a/.github/actions/test-summary/action.yml b/.github/actions/test-summary/action.yml index 6b47e1069f..1468040c78 100644 --- a/.github/actions/test-summary/action.yml +++ b/.github/actions/test-summary/action.yml @@ -23,7 +23,7 @@ runs: shell: bash - name: Download and extract install directory - uses: actions/download-artifact@v4.3.0 + uses: ./.github/actions/download-artifacts with: name: install-linux-clang-x64 path: install diff --git a/.github/actions/upload-artifacts/action.yml b/.github/actions/upload-artifacts/action.yml new file mode 100644 index 0000000000..461b3edcd4 --- /dev/null +++ b/.github/actions/upload-artifacts/action.yml @@ -0,0 +1,53 @@ +name: 'Upload Platform Artifacts' +description: 'Upload artifacts with proper file permissions and symlinks (cross-platform)' +inputs: + name: + description: 'Artifact name' + required: true + path: + description: 'Path to archive' + required: true + retention-days: + description: 'Number of days to retain artifact' + required: false + default: '30' + +runs: + using: 'composite' + steps: + # For Windows, use standard GitHub action - no symlink issues + - name: Upload artifacts (Windows) + if: runner.os == 'Windows' + uses: actions/upload-artifact@v4.6.2 + with: + name: ${{ inputs.name }} + path: ${{ inputs.path }} + retention-days: ${{ inputs.retention-days }} + + # For Linux/Unix, use custom workaround to handle symlinks properly + - name: Create archive (Unix) + if: runner.os != 'Windows' + shell: bash + run: | + BASE_PATH="${{ inputs.path }}" + ARCHIVE_NAME="${{ inputs.name }}.tar.gz" + + if [ -d "$BASE_PATH" ]; then + tar -czf "$ARCHIVE_NAME" -C "$(dirname "$BASE_PATH")" "$(basename "$BASE_PATH")" + elif [ -f "$BASE_PATH" ]; then + tar -czf "$ARCHIVE_NAME" -C "$(dirname "$BASE_PATH")" "$(basename "$BASE_PATH")" + else + echo "Error: Path $BASE_PATH does not exist" + exit 1 + fi + + echo "Created archive: $ARCHIVE_NAME" + ls -la "$ARCHIVE_NAME" + + - name: Upload archive (Unix) + if: runner.os != 'Windows' + uses: actions/upload-artifact@v4.6.2 + with: + name: ${{ inputs.name }} + path: ${{ inputs.name }}.tar.gz + retention-days: ${{ inputs.retention-days }} \ No newline at end of file