From 88e6f4bbc42bc68510f9d61387a466ed2746a396 Mon Sep 17 00:00:00 2001 From: Charanjeet Singh Date: Wed, 16 Feb 2022 15:04:09 +0530 Subject: [PATCH] chore: brew acceptance test * chore: Add cmds-to-test.sh with executable permissions Co-authored-by: chsingh --- .github/scripts/cmds-to-test.sh | 11 +++++ .github/workflows/acceptance-tests.yml | 63 +++++++++++++++++-------- .github/workflows/cli-test-homebrew.yml | 29 ------------ .github/workflows/release.yml | 9 ---- 4 files changed, 54 insertions(+), 58 deletions(-) create mode 100644 .github/scripts/cmds-to-test.sh delete mode 100644 .github/workflows/cli-test-homebrew.yml diff --git a/.github/scripts/cmds-to-test.sh b/.github/scripts/cmds-to-test.sh new file mode 100644 index 000000000..e1bd8472a --- /dev/null +++ b/.github/scripts/cmds-to-test.sh @@ -0,0 +1,11 @@ +echo "Testing these commands for verification of installations" +echo "1. twilio --version" +twilio --version +echo "2. twilio api:core:addresses:list --help" +twilio api:core:addresses:list --help +echo "3. twilio profiles:list" +twilio profiles:list +echo "4. twilio help" +twilio help +echo "5. twilio api:core:calls --help" +twilio api:core:calls --help diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index 26c55324f..49e2d7f7a 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -40,35 +40,58 @@ jobs: git fetch --prune --unshallow echo "::set-output name=TAG_NAME::$(git describe --tags $(git rev-list --tags --max-count=1))" - wait-for-oclif-releases: - name: Wait for oclif platform executables Release to complete - runs-on: ubuntu-latest + wait-for-brew-releases: + name: Wait for brew Release to complete + runs-on: macos-11 continue-on-error: true needs: [ get-branch, get-tag ] + strategy: + matrix: + node-version: [ 16.x, 14.x, 10.x ] outputs: - FAILURE_TAG_OCLIF: ${{ steps.failure_oclif.outputs.FAILURE_TAG_OCLIF }} + FAILURE_TAG_BREW: ${{ steps.failure_brew.outputs.FAILURE_TAG_BREW }} steps: - name: Checkout cli repo uses: actions/checkout@v2 - - name: Wait for Oclif Release + - name: Wait for oclif executables Release run: source .github/scripts/trigger-and-wait.sh env: INPUT_WORKFLOW_FILE_NAME: oclif-release.yml INPUT_REF: ${{ needs.get-branch.outputs.branch }} - - name: Perform install and test on binaries - id: oclif_acceptance_run + - name: Global - Testing installation of Twilio CLI (1) + if: ${{ github.respository != 'twilio/draft-release-branch' }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO_NAME: ${{ github.repository_owner }} run: | - gh release download ${{ needs.get-tag.outputs.TAG_NAME }} --pattern '*.deb' - sudo dpkg -i twilio-${{ needs.get-tag.outputs.TAG_NAME }}.deb - ls - twilio --version - twilio api --help - - name: setup oclif failure output + brew tap $REPO_NAME/brew && brew install twilio + ./.github/scripts/cmds-to-test.sh + - name: Global - Testing upgrade Twilio CLI (2) + if: ${{ github.respository != 'twilio/draft-release-branch' }} + env: + REPO_NAME: ${{ github.repository_owner }} + run: | + brew tap $REPO_NAME/brew && brew install twilio + brew upgrade twilio + ./.github/scripts/cmds-to-test.sh + - name: Draft - Testing installation of Twilio CLI (1) + if: ${{ github.respository == 'twilio/draft-release-branch' }} + env: + REPO_NAME: ${{ github.repository_owner }} + run: | + brew tap $REPO_NAME/brew && brew install twiliodraft + ./.github/scripts/cmds-to-test.sh + - name: Draft - Testing upgrade Twilio CLI (2) + if: ${{ github.respository == 'twilio/draft-release-branch' }} + env: + REPO_NAME: ${{ github.repository_owner }} + run: | + brew tap $REPO_NAME/brew && brew install twiliodraft + brew upgrade twilio + ./.github/scripts/cmds-to-test.sh + - name: setup brew failure output if: failure() || cancelled() - id: failure_oclif - run: echo '::set-output name=FAILURE_TAG_OCLIF::true' + id: failure_brew + run: echo '::set-output name=FAILURE_TAG_BREW::true' wait-for-windows-releases: name: Wait for windows platform executables Release to complete @@ -166,7 +189,7 @@ jobs: if: failure() || cancelled() id: failure_debian run: echo '::set-output name=FAILURE_TAG_DEBIAN::true' - + test-scoop-release: name: Do scoop testing after release runs-on: windows-latest @@ -197,10 +220,10 @@ jobs: run: echo '::set-output name=FAILURE_TAG_SCOOP::true' notify-complete-fail: - needs: [wait-for-oclif-releases, wait-for-windows-releases, wait-for-debian-releases, wait-for-macos-releases] + needs: [wait-for-brew-releases, wait-for-windows-releases, wait-for-debian-releases, wait-for-macos-releases, test-scoop-release] name: Notify Release Failed runs-on: ubuntu-latest - if: ${{ ( needs.wait-for-macos-releases.outputs.FAILURE_TAG_MACOS == 'true' ) || ( needs.wait-for-windows-releases.outputs.FAILURE_TAG_WINDOWS == 'true' ) || ( needs.wait-for-oclif-releases.outputs.FAILURE_TAG_OCLIF == 'true' ) || ( needs.wait-for-debian-releases.outputs.FAILURE_TAG_DEBIAN == 'true') || ( needs.test-scoop-release.outputs.FAILURE_TAG_SCOOP == 'true') }} + if: ${{ ( needs.wait-for-macos-releases.outputs.FAILURE_TAG_MACOS == 'true' ) || ( needs.wait-for-windows-releases.outputs.FAILURE_TAG_WINDOWS == 'true' ) || ( needs.wait-for-brew-releases.outputs.FAILURE_TAG_BREW == 'true' ) || ( needs.wait-for-debian-releases.outputs.FAILURE_TAG_DEBIAN == 'true') || ( needs.test-scoop-release.outputs.FAILURE_TAG_SCOOP == 'true') }} steps: - uses: actions/checkout@v2 - name: Slack Notification @@ -213,6 +236,6 @@ jobs: SLACK_TITLE: "Twilio Cli" SLACK_MESSAGE: 'CLI acceptance workflow Failed' - name: Fail in case all jobs failed - if: ${{ ( needs.wait-for-macos-releases.outputs.FAILURE_TAG_MACOS == 'true' ) && ( needs.wait-for-windows-releases.outputs.FAILURE_TAG_WINDOWS == 'true' ) && ( needs.wait-for-oclif-releases.outputs.FAILURE_TAG_OCLIF == 'true' ) && ( needs.wait-for-debian-releases.outputs.FAILURE_TAG_DEBIAN == 'true') && ( needs.test-scoop-release.outputs.FAILURE_TAG_SCOOP == 'true')}} + if: ${{ ( needs.wait-for-brew-releases.outputs.FAILURE_TAG_BREW == 'true' ) && ( needs.wait-for-macos-releases.outputs.FAILURE_TAG_MACOS == 'true' ) && ( needs.wait-for-windows-releases.outputs.FAILURE_TAG_WINDOWS == 'true' ) && ( needs.wait-for-debian-releases.outputs.FAILURE_TAG_DEBIAN == 'true') && ( needs.test-scoop-release.outputs.FAILURE_TAG_SCOOP == 'true')}} run: exit 1 diff --git a/.github/workflows/cli-test-homebrew.yml b/.github/workflows/cli-test-homebrew.yml deleted file mode 100644 index b206345fa..000000000 --- a/.github/workflows/cli-test-homebrew.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: CLI Tests on brew installations -on: - workflow_dispatch: - inputs: - version: - description: 'Version to use for running test cases' - required: true - -jobs: - test: - runs-on: macos-latest - strategy: - matrix: - node-version: [16.x, 14.x, 10.x] - steps: - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - name: Global - Testing installation of Twilio CLI (1) - run: | - brew tap twilio/brew && brew install twilio@${{ github.event.inputs.version }} - node test/asserts/validate_tests.js - - name: Global - Testing upgrade Twilio CLI (2) - run: | - brew tap twilio/brew && brew install twilio@${{ github.event.inputs.version }} - brew upgrade twilio - node test/asserts/validate_tests.js - \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9a063246b..f11fe12a0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -163,15 +163,6 @@ jobs: check-name: 'Oclif Release' repo-token: ${{ secrets.GITHUB_TOKEN }} wait-interval: 10 - - name: Run sanity testing on release-draft - if: ${{ github.event.inputs.draft-release == 'true' }} - run: node .github/scripts/trigger-workflow.js - env: - WORKFLOW_NAME: '.github/workflows/cli-test-homebrew.yml' - REPO_NAME: ${{ github.repository }} - REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }} - BRANCH_NAME: ${{steps.extract_branch.outputs.branch}} - INPUTS: '{ "version": "${{ steps.semantic-release-draft.outputs.TAG_NAME }}" }' delete-draft-release-oclif: runs-on: ubuntu-latest if: ${{github.event.inputs.draft-release == 'true'}}