Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration test for multiple OS #213

Merged
merged 12 commits into from
Jun 7, 2023
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