Skip to content

Acceptance Testing

Acceptance Testing #73

name: Acceptance Testing
on:
workflow_dispatch:
workflow_run:
# wait for Platform Executable Release to complete
workflows:
[
"Windows Executable Release",
]
branches: [main]
types:
- completed
env:
INPUT_OWNER: ${{ github.repository_owner }}
INPUT_REPO: twilio-cli
INPUT_GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
INPUT_WAITING_INTERVAL: 10
INPUT_PROPAGATE_FAILURE: true
INPUT_TRIGGER_WORKFLOW: false
jobs:
get-branch:
name: Get Current Branch Name
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.extract_branch.outputs.branch }}
steps:
- name: Extract branch name
id: extract_branch
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
get-tag:
runs-on: ubuntu-latest
outputs:
TAG_NAME: ${{steps.get-tag.outputs.TAG_NAME}}
steps:
- uses: actions/checkout@v2
- name: Getting latest tag
id: get-tag
run: |
git fetch --prune --unshallow
echo "::set-output name=TAG_NAME::$(git describe --tags $(git rev-list --tags --max-count=1))"
wait-for-brew-releases:
name: Wait for brew Release to complete
runs-on: macos-12
continue-on-error: true
strategy:
matrix:
node-version: [ 18.x, 20.x, lts/* ]
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_brew.outputs.FAILURE_TAG_BREW }}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for oclif executables Release
run: source .github/scripts/trigger-and-wait.sh
env:
INPUT_OWNER: ${{ github.repository_owner }}
INPUT_GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
INPUT_WORKFLOW_FILE_NAME: release.yml
INPUT_REF: main
INPUT_REPO: homebrew-brew
- name: Global - 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 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_brew
run: echo '::set-output name=FAILURE_TAG_BREW::true'
wait-for-windows-releases:
name: Wait for windows platform executables Release to complete
runs-on: windows-latest
needs: [ get-branch, get-tag ]
continue-on-error: true
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_windows.outputs.FAILURE_TAG_WINDOWS }}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for windows executables Release
run: bash .github/scripts/trigger-and-wait.sh
env:
INPUT_WORKFLOW_FILE_NAME: windows-executable-release.yml
INPUT_REF: ${{ needs.get-branch.outputs.branch }}
- name: Perform acceptance install and tests on Windows
id: windows_acceptance_run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ needs.get-tag.outputs.TAG_NAME }} --pattern '*.exe'
ls
(New-Object System.Net.WebClient).DownloadFile('https://get.scoop.sh', 'scoop.ps1')
./scoop.ps1 -RunAsAdmin
scoop install gsudo
./twilio-${{ needs.get-tag.outputs.TAG_NAME }}.exe /S
sleep 100
$env:Path += ";C:\Program Files (x86)\twilio-cli\bin"
$Env:Path
cd C:\"Program Files (x86)\twilio-cli"
dir
twilio --version
twilio api --help
- name: setup windows failure output
if: failure() || cancelled()
id: failure_windows
run: echo '::set-output name=FAILURE_TAG_WINDOWS::true'
wait-for-macos-releases:
name: Wait for macos platform executables Release to complete
runs-on: macos-12
continue-on-error: true
needs: [ get-branch, get-tag ]
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_macos.outputs.FAILURE_TAG_MACOS }}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for macos executables Release
run: source .github/scripts/trigger-and-wait.sh
env:
INPUT_WORKFLOW_FILE_NAME: macos-executable-release.yml
INPUT_REF: ${{ needs.get-branch.outputs.branch }}
- name: Perform acceptance install and test on binaries
id: macos_acceptance_run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ needs.get-tag.outputs.TAG_NAME }} --pattern '*.pkg'
sudo installer -pkg twilio-${{ needs.get-tag.outputs.TAG_NAME }}-x64.pkg -target ~/
ls
twilio --version
twilio api --help
- name: setup macos failure output
if: failure() || cancelled()
id: failure_macos
run: echo '::set-output name=FAILURE_TAG_MACOS::true'
wait-for-debian-releases:
name: Wait for debian platform executables Release to complete
runs-on: ubuntu-latest
needs: [ get-branch, get-tag ]
continue-on-error: true
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_debian.outputs.FAILURE_TAG_DEBIAN }}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for debian executables Release
run: source .github/scripts/trigger-and-wait.sh
env:
INPUT_WORKFLOW_FILE_NAME: debian-executable-release.yml
INPUT_REF: ${{ needs.get-branch.outputs.branch }}
- name: Perform acceptance install and test on binaries
id: debian_acceptance_run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ needs.get-tag.outputs.TAG_NAME }} --pattern '*amd64.deb'
sudo dpkg -i twilio-${{ needs.get-tag.outputs.TAG_NAME }}-amd64.deb
ls
twilio --version
twilio api --help
- name: setup debian failure output
if: failure() || cancelled()
id: failure_debian
run: echo '::set-output name=FAILURE_TAG_DEBIAN::true'
test-apt-release:
name: Wait for apt release to complete
runs-on: ubuntu-latest
needs: [ get-branch, get-tag ]
continue-on-error: true
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.apt.outputs.FAILURE_TAG_APT}}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for apt Release
run: source .github/scripts/trigger-and-wait.sh
env:
INPUT_WORKFLOW_FILE_NAME: apt-release.yml
INPUT_REF: ${{ needs.get-branch.outputs.branch }}
- name: Perform acceptance install and test on apt package
id: apt_acceptance_run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget -qO- https://twilio-cli-prod.s3.amazonaws.com/twilio_pub.asc | sudo apt-key add -
sudo touch /etc/apt/sources.list.d/twilio.list
echo 'deb https://twilio-cli-prod.s3.amazonaws.com/apt/ /' | sudo tee /etc/apt/sources.list.d/twilio.list
sudo apt update
sudo apt install -y twilio
ls
twilio --version
twilio api --help
.github/scripts/cmds-to-test.sh
- name: APT upgrade twilio package
run: |
sudo apt-get install --only-upgrade twilio
.github/scripts/cmds-to-test.sh
- name: APT downgrade twilio package
run: |
sudo apt-get install -y twilio=3.1.0-1 --allow-downgrades
twilio --version
.github/scripts/cmds-to-test.sh
- name: setup apt failure output
if: failure() || cancelled()
id: failure_apt
run: echo '::set-output name=FAILURE_TAG_APT::true'
test-npm-releases:
name: NPM acceptance testing
runs-on: ubuntu-latest
continue-on-error: true
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_npm.outputs.FAILURE_TAG_NPM }}
strategy:
matrix:
node-version: [ 18.x, 20.x, lts/* ]
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/checkout@v2
with:
node-version: ${{ matrix.node-version }}
- name: Check for cached twilio installation
run: |
if ! command -v twilio > /dev/null; then twilio() { printf '%sCLI is not installed, all good. '; } else echo "CLI is installed already, Abort."; exit 1; fi
twilio --version
- name: Node Install - Testing installation of Twilio CLI (1)
if: ${{ github.respository != 'twilio/draft-release-branch' }}
run: |
npm install -g twilio-cli
.github/scripts/cmds-to-test.sh
- name: NPM Update - Testing upgrade Twilio CLI (2)
if: ${{ github.respository != 'twilio/draft-release-branch' }}
run: |
npm update -g twilio-cli
.github/scripts/cmds-to-test.sh
- name: Node Install - Testing installation of Twilio CLI (1)
if: ${{ github.respository == 'twilio/draft-release-branch' }}
run: |
npm install -g twilio-cli@$(npm view twilio-cli dist-tags.draft-release-branch)
.github/scripts/cmds-to-test.sh
- name: NPM Update - Testing upgrade Twilio CLI (2)
if: ${{ github.respository == 'twilio/draft-release-branch' }}
run: |
npm update -g twilio-cli@$(npm view twilio-cli dist-tags.draft-release-branch)
.github/scripts/cmds-to-test.sh
- name: setup debian failure output
if: failure() || cancelled()
id: failure_npm
run: echo '::set-output name=FAILURE_TAG_NPM::true'
test-scoop-release:
name: Do scoop testing after release
runs-on: windows-latest
continue-on-error: true
outputs:
ACCEPTANCE_FAILURE_TAG: ${{ steps.failure_scoop.outputs.FAILURE_TAG_SCOOP }}
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Wait for Scoop release to finish
run: bash .github/scripts/trigger-and-wait.sh
env:
INPUT_WORKFLOW_FILE_NAME: update-release.yml
INPUT_REF: main
INPUT_OWNER: ${{ github.repository_owner }}
INPUT_REPO: scoop-twilio-cli
INPUT_GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Perform testing on scoop installations
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
(New-Object System.Net.WebClient).DownloadFile('https://get.scoop.sh', 'scoop.ps1')
./scoop.ps1 -RunAsAdmin
scoop bucket add twilio-scoop https://github.com/twilio/scoop-twilio-cli
scoop install twilio
twilio --version
twilio api --help
- name: Draft - Perform testing on scoop installations
if: ${{ github.respository == 'twilio/draft-release-branch' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
(New-Object System.Net.WebClient).DownloadFile('https://get.scoop.sh', 'scoop.ps1')
./scoop.ps1 -RunAsAdmin
scoop bucket add twilio-scoop https://github.com/twilio/scoop-twilio-cli
scoop install twiliodraft
twilio --version
twilio api --help
- name: setup scoop failure output
if: failure() || cancelled()
id: failure_scoop
run: echo '::set-output name=FAILURE_TAG_SCOOP::true'
notify-complete-fail:
needs: [wait-for-brew-releases, wait-for-windows-releases, wait-for-debian-releases, wait-for-macos-releases, test-scoop-release, test-npm-releases, test-apt-release]
name: Notify Release Failed
runs-on: ubuntu-latest
if: ${{ contains( needs.*.outputs.ACCEPTANCE_FAILURE_TAG, 'true' ) }}
steps:
- uses: actions/checkout@v2
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.ALERT_SLACK_WEB_HOOK }}
SLACK_COLOR: "#ff3333"
SLACK_USERNAME: CLI Release Bot
SLACK_ICON_EMOJI: ":ship:"
SLACK_TITLE: "Twilio Cli"
SLACK_MESSAGE: 'CLI acceptance workflow Failed'
- name: Fail in case all jobs failed
if: |
${{ ( needs.test-npm-releases.outputs.ACCEPTANCE_FAILURE_TAG == 'true' ) &&
( needs.wait-for-brew-releases.outputs.ACCEPTANCE_FAILURE_TAG == 'true' ) &&
( needs.wait-for-macos-releases.outputs.ACCEPTANCE_FAILURE_TAG == 'true' ) &&
( needs.wait-for-windows-releases.outputs.ACCEPTANCE_FAILURE_TAG == 'true' ) &&
( needs.wait-for-debian-releases.outputs.ACCEPTANCE_FAILURE_TAG == 'true') &&
( needs.test-scoop-release.outputs.ACCEPTANCE_FAILURE_TAG == 'true')}}
( needs.test-apt-release.outputs.ACCEPTANCE_FAILURE_TAG} == 'true')}}
run:
exit 1