From 3a57a51c3b0509607a1326ec6d03eafddd85afcc Mon Sep 17 00:00:00 2001 From: Igor Zinovyev Date: Thu, 5 Sep 2024 20:56:09 +0300 Subject: [PATCH] Added a CI job for WPCloud testing of wpcomsh. --- .github/workflows/wpcloud.yml | 95 +++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 .github/workflows/wpcloud.yml diff --git a/.github/workflows/wpcloud.yml b/.github/workflows/wpcloud.yml new file mode 100644 index 0000000000000..7b8ce692517a8 --- /dev/null +++ b/.github/workflows/wpcloud.yml @@ -0,0 +1,95 @@ +name: WPCloud Unit Testing for WPCOMSH + +on: + pull_request: + push: + branches: ['trunk', '*/branch-*'] +concurrency: + group: wpcloud-${{ github.event_name }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + deploy: + name: Run phpunit on WPCloud site + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # codecov.io requires a fetch depth > 1. + fetch-depth: 2 + + # For pull requests, list-changed-projects.sh needs the merge base. + # But it doesn't have to be checked out. + - name: Deepen to merge base + if: github.event_name == 'pull_request' + uses: ./.github/actions/deepen-to-merge-base + with: + checkout: false + + - name: Detect if wpcomsh has changed + id: changed + run: | + CHANGED="$(EXTRA=test .github/files/list-changed-projects.sh)" + + WPCOMSH_CHANGED="$(jq --argjson changed "$CHANGED" -n '$changed | has( "plugins/wpcomsh" ) ')" + echo "wpcomsh=${WPCOMSH_CHANGED}" >> "$GITHUB_OUTPUT" + + - name: Configure Github to be able to SSH to the Atomic site + if: steps.changed.outputs.wpcomsh == 'true' + run: | + echo "Intializing" + echo "::group::setup" + + mkdir -vp ~/.ssh/ + chmod -v 700 ~/.ssh + + touch ~/.ssh/id_site + chmod 600 ~/.ssh/id_site + echo "$WPCLOUD_SSH_KEY" > ~/.ssh/id_site + echo "wrote ~/.ssh/id_site" + + touch ~/.ssh/askpass + chmod -v 700 ~/.ssh/askpass + cat >>~/.ssh/askpass <>~/.ssh/config <>~/.ssh/stdin <