Skip to content

Commit

Permalink
Fix CI (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
creasty authored May 30, 2024
1 parent 189644f commit 29d6ac9
Show file tree
Hide file tree
Showing 15 changed files with 251 additions and 240 deletions.
24 changes: 13 additions & 11 deletions .github/workflows/provisioning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,43 @@ name: provisioning

on:
push:
workflow_dispatch:
schedule:
# Every Monday, at 10:00 JST
- cron: "0 1 * * 1"

jobs:
macos:
runs-on: macos-12 # https://github.com/actions/virtual-environments
# cf. https://github.com/actions/runner-images/tree/main/images/macos
runs-on: macos-14
env:
HOMEBREW_VERBOSE: 1
DOTFILES_NOEDIT_SECRETS: 1
strategy:
fail-fast: false
matrix:
include:
- tags: base,install.homebrew.formula
- tags: base,lang
- tags: install,app,system
- name: fundamental
tags: base,install.homebrew.tap,install.homebrew.formula
- name: language support
tags: base,lang
- name: apps and system
tags: install,app,system
skip_tags: install.homebrew.formula
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v2

- name: Link to home
run: ln -sf "$PWD" "$HOME/dotfiles"

# Refer to https://github.com/actions/runner-images/tree/main/images/macos/provision
- name: Uninstall homebrew
run: |
set -euxo pipefail
brew list --cask | xargs brew uninstall --force
brew list | xargs brew uninstall --force --ignore-dependencies
# cf. https://github.com/homebrew/install#uninstall-homebrew
NONINTERACTIVE=1 HAVE_SUDO_ACCESS=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
rm -rf /usr/local/bin/*
# Remove residual files
sudo rm -rf /opt/homebrew/
- name: Install SSH key
run: |
Expand Down
1 change: 1 addition & 0 deletions config/rbenv/default-gems
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ rails
solargraph

# iOS development
cocoapods
synx
xcode-install
47 changes: 29 additions & 18 deletions provision
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ clone_or_update_repo() {
fi
}

load_envs() {
export ANYENV_INIT_CACHE_DISABLED=1
source "$DOTFILES_PATH/shell/profile"
}

check_xcode_license_approved() {
accept_xcode_license() {
echo 'Agreeing to Xcode license...'

if ! [[ "$(/usr/bin/xcrun clang 2>&1 || true)" =~ 'license' ]]; then
Expand All @@ -85,6 +80,22 @@ check_xcode_license_approved() {
echo 'done'
}

install_rosetta2() {
echo 'Installing Rosetta 2...'
if [ -d /usr/libexec/rosetta ]; then
echo 'skip (already installed)'
return
fi
sudo softwareupdate --install-rosetta --agree-to-license
echo 'done'
}

load_envs() {
export ANYENV_INIT_CACHE_DISABLED=1
# shellcheck source=/dev/null
. "$DOTFILES_PATH/shell/profile"
}

install_homebrew() {
command -v 'brew' > /dev/null 2>&1 && return

Expand All @@ -93,6 +104,15 @@ install_homebrew() {
echo 'done'
}

install_python3() {
command -v 'python3' > /dev/null 2>&1 && return
python3 --version > /dev/null 2>&1 && return

echo 'Installing python3...'
brew install [email protected]
echo 'done'
}

install_ansible() {
command -v 'ansible' > /dev/null 2>&1 && return

Expand All @@ -101,16 +121,6 @@ install_ansible() {
echo 'done'
}

install_rosetta2() {
echo 'Installing Rosetta 2...'
if [ -d /usr/libexec/rosetta ]; then
echo 'skip (already installed)'
return
fi
sudo softwareupdate --install-rosetta --agree-to-license
echo 'done'
}

run_provisioning() {
echo 'Provisioning...'

Expand Down Expand Up @@ -140,12 +150,13 @@ main() {
print_header
check_os
clone_or_update_repo
check_xcode_license_approved
accept_xcode_license
install_rosetta2

load_envs
install_homebrew
install_python3
install_ansible
install_rosetta2
run_provisioning "$@"
}

Expand Down
Loading

0 comments on commit 29d6ac9

Please sign in to comment.