Skip to content

Commit

Permalink
Integration test for multiple OS (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubramanianaks committed Jun 7, 2023
1 parent 580337c commit 4fc212e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/integration-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,31 @@ on:

jobs:
install:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Run Install Script
- name: Run Install Script
shell: bash
run: ./scripts/install.sh
- name: Validate Command is Installed
shell: bash
run: |
if ! command -v draft &> /dev/null
if command -v /home/runner/.local/bin/draft &> /dev/null
then
echo "draft could not be found"
exit 1
echo "install_dir=/home/runner/.local/bin/draft" >> $GITHUB_ENV
elif command -v /usr/local/bin/draft &> /dev/null
then
echo "install_dir=/usr/local/bin/draft" >> $GITHUB_ENV
elif command -v /c/Users/runneradmin/.local/bin/draft &> /dev/null
then
echo "install_dir=/c/Users/runneradmin/.local/bin/draft" >> $GITHUB_ENV
else
echo "draft could not be found"
exit 1
fi
- name: Validate Draft Command Runs
run: draft -h
shell: bash
run: ${{ env.install_dir }} -h
12 changes: 8 additions & 4 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ check_jq_processor_present(){

# Download draft cli stable version.
download_draft_cli_stable_version(){
FILENAME="draft-$OS-$ARCH"
if [ "$OS" == "windows" ]; then
FILENAME="draft-$OS-$ARCH".exe
else
FILENAME="draft-$OS-$ARCH"
fi
log INFO "Starting Draft CLI Download for $FILENAME"
DRAFTCLIVERSION=$(curl -L -s https://api.github.com/repos/Azure/draft/releases/latest | jq -r '.tag_name')
log INFO "Starting Draft CLI Version $DRAFTCLIVERSION"
Expand All @@ -123,7 +127,7 @@ file_issue_prompt() {
}

copy_draft_files() {
if [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then
if [[ ":$PATH:" == *":$HOME/.local/bin:"* || "$OS" == "windows" ]]; then
if [ ! -d "$HOME/.local/bin" ]; then
mkdir -p "$HOME/.local/bin"
fi
Expand All @@ -143,8 +147,8 @@ install() {
OS="linux"
elif [[ "$OSTYPE" == "darwin"* ]]; then
OS="darwin"
elif [[ "$OSTYPE" == "win32" ]]; then
OS="win"
elif [[ "$OSTYPE" == "win32" || "$OSTYPE" == "msys" ]]; then
OS="windows"
else
echo "Draft CLI isn't supported for your platform - $OSTYPE"
file_issue_prompt
Expand Down

0 comments on commit 4fc212e

Please sign in to comment.