E2E tests #477
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: E2E tests | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| ocis_version: | |
| type: string | |
| required: false | |
| app_version: | |
| type: string | |
| required: false | |
| default: 'master' | |
| tag: | |
| type: string | |
| required: false | |
| default: 'not @ignore and not @noocis and not @noci' | |
| schedule: | |
| - cron: '30 2 * * 1' # Monday at 02:30 UTC | |
| - cron: '30 2 * * 2-5' # Tuesday to Friday at 2:30AM | |
| permissions: | |
| contents: read | |
| env: | |
| SINCE_REF: ${{ github.event.schedule == '30 2 * * 1' && 'last friday' || 'yesterday' }} | |
| UNTIL_REF: ${{ github.event.schedule == '30 2 * * 1' && 'last saturday' || 'today' }} | |
| APP_VERSION: ${{ inputs.app_version || 'master' }} | |
| jobs: | |
| # Firstly, check if there were changes the day before. If not, aborting | |
| check_repo_changes: | |
| name: Check changes in Android app | |
| runs-on: ubuntu-latest | |
| outputs: | |
| has_changes: ${{ steps.check.outputs.has_changes }} | |
| steps: | |
| - name: Checkout external repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1 | |
| with: | |
| repository: owncloud/android | |
| ref: ${{ env.APP_VERSION }} | |
| fetch-depth: 0 | |
| path: android-repo | |
| - name: Check commits from previous day | |
| id: check | |
| shell: bash | |
| run: | | |
| cd android-repo | |
| export TZ="Europe/Madrid" | |
| echo "APP_VERSION=$APP_VERSION" | |
| SINCE=$(date -d "$SINCE_REF" +"%Y-%m-%d 00:00:00") | |
| UNTIL=$(date -d "$UNTIL_REF" +"%Y-%m-%d 00:00:00") | |
| echo "Checking commits in external repo between:" | |
| echo "SINCE=$SINCE" | |
| echo "UNTIL=$UNTIL" | |
| COMMITS=$(git rev-list --count --since="$SINCE" --until="$UNTIL" HEAD) | |
| echo "Commits found: $COMMITS" | |
| if [ "$COMMITS" -gt 0 ]; then | |
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "has_changes=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| # Builds apk | |
| build_apk: | |
| needs: | |
| - check_repo_changes | |
| if: github.event_name == 'workflow_dispatch' || needs.check_repo_changes.outputs.has_changes == 'true' | |
| uses: owncloud/android/.github/workflows/build-apk.yml@master | |
| with: | |
| build_variant: qaRelease | |
| version: ${{ inputs.app_version || 'master' }} | |
| # Creates an oCIS server | |
| create_ocis: | |
| needs: | |
| - check_repo_changes | |
| if: github.event_name == 'workflow_dispatch' || needs.check_repo_changes.outputs.has_changes == 'true' | |
| uses: ./.github/workflows/ocisbackend.yml | |
| with: | |
| ocis_version: ${{ inputs.ocis_version || vars.OCIS_VERSION }} | |
| secrets: | |
| ocis_url: ${{ secrets.OC_SERVER_URL }} | |
| ssh_host: ${{ secrets.SSH_HOST }} | |
| ssh_user: ${{ secrets.SSH_USER }} | |
| ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| ocis_pwd: ${{ secrets.OCIS_PWD }} | |
| # Launches the tests | |
| tests: | |
| if: github.event_name == 'workflow_dispatch' || needs.check_repo_changes.outputs.has_changes == 'true' | |
| needs: | |
| - check_repo_changes | |
| - build_apk | |
| - create_ocis | |
| uses: ./.github/workflows/e2etests.yml | |
| with: | |
| apk: ${{ needs.build_apk.outputs.artifact_name }} | |
| backend: oCIS | |
| tag: ${{ inputs.tag || 'not @ignore and not @noocis and not @noci' }} | |
| secrets: | |
| oc_server_url: ${{ secrets.OC_SERVER_URL }} | |
| # Server clean up | |
| cleanup: | |
| needs: | |
| - check_repo_changes | |
| - tests | |
| if: always() && (github.event_name == 'workflow_dispatch' || needs.check_repo_changes.outputs.has_changes == 'true') | |
| uses: ./.github/workflows/cleanup.yml | |
| secrets: | |
| ssh_host: ${{ secrets.SSH_HOST }} | |
| ssh_user: ${{ secrets.SSH_USER }} | |
| ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} |