diff --git a/.github/actions/backup-restore-test/action.yml b/.github/actions/backup-restore-test/action.yml index 95e41d1bb..20b3fdd43 100644 --- a/.github/actions/backup-restore-test/action.yml +++ b/.github/actions/backup-restore-test/action.yml @@ -12,7 +12,7 @@ inputs: required: false default: "" restore-args: - description: Arguments to pass for restore + description: Arguments to pass for restore; restore is skipped when missing. required: false default: "" test-folder: @@ -28,6 +28,10 @@ inputs: description: Value for the --collisions flag requried: false default: "replace" + with-export: + description: Runs export tests when true + required: false + default: false outputs: backup-id: @@ -52,6 +56,7 @@ runs: tee $GITHUB_OUTPUT - name: Restore ${{ inputs.service }} ${{ inputs.kind }} + if: inputs.restore != "" id: restore shell: bash working-directory: src @@ -73,6 +78,7 @@ runs: cat /tmp/corsologs - name: Check restore ${{ inputs.service }} ${{ inputs.kind }} + if: ${{ inputs.restore != "" }} shell: bash working-directory: src env: @@ -86,10 +92,10 @@ runs: ./sanity-test - name: Export ${{ inputs.service }} ${{ inputs.kind }} + if: ${{ inputs.with-export == true }} id: export shell: bash working-directory: src - if: ${{ inputs.service == 'onedrive' || inputs.service == 'sharepoint' }} run: | set -euo pipefail CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-restore-${{ inputs.service }}-${{inputs.kind }}.log @@ -103,9 +109,9 @@ runs: cat /tmp/corsologs - name: Check export ${{ inputs.service }} ${{ inputs.kind }} + if: ${{ inputs.with-export == true }} shell: bash working-directory: src - if: ${{ inputs.service == 'onedrive' || inputs.service == 'sharepoint' }} env: SANITY_TEST_KIND: export SANITY_TEST_FOLDER: /tmp/export-${{ inputs.service }}-${{inputs.kind }} @@ -117,10 +123,10 @@ runs: ./sanity-test - name: Export archive ${{ inputs.service }} ${{ inputs.kind }} + if: ${{ inputs.with-export == true }} id: export-archive shell: bash working-directory: src - if: ${{ inputs.service == 'onedrive' }} # Export only available for OneDrive run: | set -euo pipefail CORSO_LOG_FILE=${{ inputs.log-dir }}/gotest-restore-${{ inputs.service }}-${{inputs.kind }}.log @@ -137,9 +143,9 @@ runs: cat /tmp/corsologs - name: Check archive export ${{ inputs.service }} ${{ inputs.kind }} + if: ${{ inputs.with-export == true }} shell: bash working-directory: src - if: ${{ inputs.service == 'onedrive' }} env: SANITY_TEST_KIND: export SANITY_TEST_FOLDER: /tmp/export-${{ inputs.service }}-${{inputs.kind }}-unzipped diff --git a/.github/workflows/sanity-test.yaml b/.github/workflows/sanity-test.yaml index 292c358dd..d7774c66e 100644 --- a/.github/workflows/sanity-test.yaml +++ b/.github/workflows/sanity-test.yaml @@ -241,6 +241,7 @@ jobs: restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }} --restore-permissions' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }}' log-dir: ${{ env.CORSO_LOG_DIR }} + with-export: true # generate some more enteries for incremental check - name: OneDrive - Create new data (for incremental) @@ -263,6 +264,7 @@ jobs: restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }} --restore-permissions' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-onedrive.outputs.result }}' log-dir: ${{ env.CORSO_LOG_DIR }} + with-export: true ########################################################################################################################################## @@ -295,6 +297,7 @@ jobs: restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }} --restore-permissions' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }}' log-dir: ${{ env.CORSO_LOG_DIR }} + with-export: true # generate some more enteries for incremental check - name: SharePoint - Create new data (for incremental) @@ -318,6 +321,53 @@ jobs: restore-args: '--folder ${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }} --restore-permissions' test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-sharepoint.outputs.result }}' log-dir: ${{ env.CORSO_LOG_DIR }} + with-export: true + +########################################################################################################################################## + +# Groups and Teams + + # generate new entries for test + - name: Groups - Create new data + if: false # TODO: enable when ready + id: new-data-creation-groups + working-directory: ./src/cmd/factory + run: | + suffix=$(date +"%Y-%m-%d_%H-%M-%S") + + go run . sharepoint files \ + --site ${{ secrets.CORSO_M365_TEST_GROUPS_SITE_URL }} \ + --user ${{ env.TEST_USER }} \ + --secondaryuser ${{ env.CORSO_SECONDARY_M365_TEST_USER_ID }} \ + --tenant ${{ secrets.TENANT_ID }} \ + --destination ${{ env.RESTORE_DEST_PFX }}$suffix \ + --count 4 + + echo result="${suffix}" >> $GITHUB_OUTPUT + + - name: Groups - Backup + if: false # TODO: enable when ready + id: groups-backup + uses: ./.github/actions/backup-restore-test + with: + service: groups + kind: initial + backup-args: '--group "${{ secrets.CORSO_M365_TEST_TEAM_ID }}"' + test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-groups.outputs.result }}' + log-dir: ${{ env.CORSO_LOG_DIR }} + + - name: Teams - Backup + if: false # TODO: enable when ready + id: teams-backup + uses: ./.github/actions/backup-restore-test + with: + service: teams + kind: initial + backup-args: '--group "${{ secrets.CORSO_M365_TEST_TEAM_ID }}"' + test-folder: '${{ env.RESTORE_DEST_PFX }}${{ steps.new-data-creation-groups.outputs.result }}' + log-dir: ${{ env.CORSO_LOG_DIR }} + + # TODO: incrementals ##########################################################################################################################################