-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (67 loc) · 2.77 KB
/
macos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: macos
on:
workflow_dispatch:
push:
branches-ignore:
- main
paths:
- .github/workflows/macos.yml
- ansible/files/**
- ansible/handlers/**
- ansible/main.yml
- ansible/tasks/MacOSX.yml
- ansible/tasks/common.yml
- ansible/vars/Darwin.yml
- ansible/vars/common.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions: read-all
jobs:
macos:
runs-on: macos-14
timeout-minutes: 100
steps:
- name: Uninstall Homebrew packages
run: |
set -euxo pipefail
# shellcheck disable=SC2046
brew remove --force $(brew list --formula)
# shellcheck disable=SC2046
brew remove --cask --force $(brew list)
rm -v /usr/local/bin/2to3* /usr/local/bin/idle* /usr/local/bin/pydoc* /usr/local/bin/python* || true
- name: Install Ansible
run: |
brew install ansible
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- name: Ansible
run: |
cd ansible || exit
echo "test_password" > vault-my_workstation.password
ansible-playbook --skip-tags data,interactive,secrets,skip_test --connection=local -i "127.0.0.1," main.yml
- name: Ansible - Idempotence tests
run: |
cd ansible || exit
ansible-playbook --skip-tags data,interactive,secrets,skip_test,skip_idempotence_test --connection=local -i "127.0.0.1," main.yml | tee /tmp/ansible.log
# https://stackoverflow.com/questions/59361798/github-actions-functions-on-the-console-output
if [ "$(grep -c 'changed=0.*failed=0' /tmp/ansible.log)" = "1" ] ; then
echo -e '\n✅ Idempotence test: pass'
exit 0
else
echo -e '\n❗️ Idempotence test: fail\n'
grep -B 2 '^changed:' /tmp/ansible.log
exit 1
fi
# https://apple.stackexchange.com/questions/313130/with-brew-how-do-i-only-list-packages-that-were-built-from-source-not-poured-f
- name: List brew packages that were built from source (deally empty)
run: |
brew info --json=v1 --installed | jq -r "map(select(.installed[].poured_from_bottle | not) | .name) | unique | .[]"
# https://gist.github.com/eguven/23d8c9fc78856bd20f65f8bcf03e691b
- name: List brew packages and their sizes
run: |
brew list --formula | xargs -P8 -I {} sh -c "brew info {} | ggrep -E '[0-9]* files, ' | grep -v 'KB' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | sort -h -r -k2 - | column -t
- name: Brew packages dependency tree
run: |
for FORMULA in $(brew leaves --installed-on-request); do
echo "*** ${FORMULA}"
brew deps --tree --installed "${FORMULA}"
done