Skip to content

Instantly share code, notes, and snippets.

@emadhegab
Last active July 5, 2023 08:12
Show Gist options
  • Save emadhegab/fd36581ad3c4d868cb7533a56099f275 to your computer and use it in GitHub Desktop.
Save emadhegab/fd36581ad3c4d868cb7533a56099f275 to your computer and use it in GitHub Desktop.
ci-cd.sh
#!/bin/bash
echo -e "##=====> changing default shell to /bin/bash"
chsh -s /bin/bash
echo -e "##=====> installing homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
echo -e "##=====> refreshing the environment"
source ~/.bash_profile
echo -e "##=====> installing gitlab runner"
brew install gitlab-runner
echo -e "##=====> configuring gitlab-runner to start on boot"
brew services start gitlab-runner
echo -e "##=====> limiting gitlab runner to 1 concurrent job"
sed -i '' 's/concurrent = .*/concurrent = 1/' /usr/local/etc/gitlab-runner/config.toml
echo -e "##=====> installing Xcode"
# Install Mas (command-line interface for Mac App Store)
brew install mas
# Search for Xcode showing only the first 5 results
mas search xcode | head -5
# Install Xcode using App ID
mas install 497799835 # The appid for Xcode shown when doing search
sudo xcode-select -r # Reset the development directory path to put to Xcode /Applications/Xcode.app/Contents/Developer
#sudo xcodebuild -license
# Updaate all Apple software and auto agree to any licenses and restart if necessary
sudo softwareupdate --install --agree-to-license -aR
echo -e "##=====> pointing xcode-select to the Xcode app"
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
echo -e "##=====> installing rosetta"
softwareupdate --install-rosetta
echo -e "##=====> disabling sleep and screensaver"
caffeinate -d -i -m -s 0 -t 31536000
echo -e "##=====> installing sonar-scanner, java, gitlab release-cli, node"
brew install sonar-scanner java gitlab-release-cli node
echo -e "##=====> installing rbenv"
brew install rbenv
echo -e "##=====> adding rbenv init to bash so it starts automatically"
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
echo -e "##=====> installing ruby version 3.1.0 with rbenv"
rbenv install 3.1.0
rbenv global 3.1.0
# registering a gitlab runner
echo -e "##=====> Enter GitLab URL:"
read GITLAB_URL
echo -e "##=====> Enter Registration Token:"
read REGISTRATION_TOKEN
echo -e "##=====> registering a gitlab runner"
gitlab-runner register --non-interactive --url "$GITLAB_URL" --registration-token "$REG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment