Skip to content

Commit

Permalink
feat: platform executables sanity testing (twilio#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrutiburman authored Nov 28, 2021
1 parent 9899fdf commit 369c152
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 7 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/platform-exec-sanity-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Platform Executable Sanity testing
on:
workflow_dispatch:
workflow_run:
# wait for Platform Executable Release to complete
workflows: ["Platform Executable Release"]
branches: [main]
types:
- completed

jobs:
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))"
platform-exec-test:
name: Test for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [get-tag]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
extension_type: '.deb'
cmds_to_execute: sudo dpkg -i twilio-${{ needs.get-tag.outputs.TAG_NAME }}.deb
- os: macos-latest
extension_type: '.pkg'
cmds_to_execute: sudo installer -pkg twilio-${{ needs.get-tag.outputs.TAG_NAME }}.pkg -target ~/
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Perform sanity install and test on binaries
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ needs.get-tag.outputs.TAG_NAME }} --pattern '*${{matrix.extension_type}}'
${{matrix.cmds_to_execute}}
ls
twilio --version
twilio api --help
platform-exec-test-Windows:
name: Test for Windows
runs-on: windows-latest
needs: [get-tag]
steps:
- name: Checkout cli repo
uses: actions/checkout@v2
- name: Perform sanity install and tests on Windows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release download ${{ needs.get-tag.outputs.TAG_NAME }} --pattern '*.exe'
ls
iwr -useb get.scoop.sh | iex
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
2 changes: 1 addition & 1 deletion .github/workflows/platform-executables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
artifact_name: macos/${{ github.event.inputs.formula }}-v${{ needs.get-tag.outputs.TAG_NAME }}.pkg
asset_name: ${{ github.event.inputs.formula }}-${{ needs.get-tag.outputs.TAG_NAME }}.pkg
command_name: npx oclif-dev pack:macos

steps:
- uses: actions/checkout@v2
- run: |
Expand All @@ -50,6 +49,7 @@ jobs:
ASSET_NAME: ${{ matrix.asset_name }}
TAG_NAME: ${{ needs.get-tag.outputs.TAG_NAME }}
REPO_NAME: twilio/twilio-cli

notify-complete-fail:
if: ${{ failure() || cancelled() }}
needs: [ platform-executables-release ]
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ jobs:
if: ${{steps.semantic-release.outputs.TAG_NAME != ''}}
run: node .github/scripts/update-release.js
env:
REPO_ACCESS_TOKEN: ${{ github.token }}
TAG_NAME: ${{steps.semantic-release.outputs.TAG_NAME}}
RELEASE_BODY: ${{github.event.inputs.change-log}}
REPO_NAME: twilio/twilio-cli
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUTS: '{ "tag-name": "${{needs.release.outputs.draft-tag-name}}" }'
delete-draft-release:
if: ${{github.event.inputs.draft-release == 'true' && needs.release.outputs.draft-tag-name != ''}}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -139,6 +141,7 @@ jobs:
INPUTS: '{ "home-brew-branch": "${{github.event.inputs.homebrew-branch}}", "tag-name": "${{needs.release.outputs.draft-tag-name}}-draft", "pre-release": "${{github.event.inputs.homebrew-prerelease}}"}'
oclif-draft-sanity-test:
runs-on: ubuntu-latest
if: ${{github.event.inputs.draft-release == 'true'}}
needs: [oclif-release]
steps:
- name: Extract branch name
Expand All @@ -162,10 +165,10 @@ jobs:
INPUTS: '{ "version": "${{ steps.semantic-release-draft.outputs.TAG_NAME }}" }'
delete-draft-release-oclif:
runs-on: ubuntu-latest
if: ${{github.event.inputs.draft-release == 'true'}}
needs: [oclif-release]
steps:
- name: Delete draft release
if: ${{github.event.inputs.draft-release == 'true'}}
run: node .github/scripts/trigger-workflow.js
env:
WORKFLOW_NAME: '.github/workflows/delete-draft-tag-release.yml'
Expand Down Expand Up @@ -195,7 +198,6 @@ jobs:
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}
platform-executables-release:
if: ${{github.event.inputs.draft-release != 'true'}}
runs-on: ubuntu-latest
needs: [ release ]
steps:
Expand All @@ -215,6 +217,7 @@ jobs:
REPO_NAME: twilio/twilio-cli
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
BRANCH_NAME: ${{steps.extract_branch.outputs.branch}}

notify-complete-fail:
if: ${{ failure() || cancelled() }}
needs: [ release, oclif-release, platform-executables-release ]
Expand Down
2 changes: 1 addition & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"changelogFile": "CHANGES.md"
}
],
"@semantic-release/npm",
"@semantic-release/npm",
[
"@semantic-release/github",
{
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 369c152

Please sign in to comment.