forked from pivotal-sprout/sprout-wrap
-
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (127 loc) · 4.43 KB
/
ci.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
name: ci
"on":
pull_request:
branches:
- master
- main
- develop
paths:
- '**/Brewfile**'
- 'Cheffile**'
- 'Gemfile**'
- 'Makefile'
- '**.mk'
- 'bootstrap-scripts/**'
- 'bin/convert_soloistrc_to_brewfile.rb'
- 'test/fixtures/soloistrc'
- 'test/fixtures/Gemfile**'
- 'test/fixtures/Brewfile**'
push:
branches:
- master
- main
- develop
paths:
- '**/Brewfile**'
- 'Cheffile**'
- 'Gemfile**'
- 'Makefile'
- '**.mk'
- 'bootstrap-scripts/**'
- 'bin/convert_soloistrc_to_brewfile.rb'
- 'test/fixtures/soloistrc'
- 'test/fixtures/Gemfile**'
- 'test/fixtures/Brewfile**'
env:
debug_ci: false
jobs:
bootstrap:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12]
steps:
- name: DEBUG What is GitHub Actions IP?
run: |
curl -Lvs ifconfig.co
- name: DEBUG the failing 502 URL
run: |
curl -v 'https://supermarket.getchef.com/api/v1/cookbooks/dmg/versions/4.1.1'
- name: Check out code
uses: actions/checkout@v4
- name: Add --no-document to .gemrc
run: |
tee -a $HOME/.gemrc <<EOGEMRC
install: --no-document
update: --no-document
EOGEMRC
- uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Add SSH_AUTH_SOCK to root shell .profile
run: |
sudo tee -a ~root/.profile <<EOPROFILE
SSH_AUTH_SOCK=${{ env.SSH_AUTH_SOCK }}
EOPROFILE
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
cache-version: 1
- name: Set BREWFILE_PATH env var
run: |
echo "BREWFILE_PATH=${GITHUB_WORKSPACE}/test/fixtures/tmp/Brewfile.ci" >> $GITHUB_ENV
- name: DEBUG - GitHub Cache Paths BREWFILE_PATH
run: |
echo BREWFILE_PATH=$BREWFILE_PATH
echo GITHUB_WORKSPACE=$GITHUB_WORKSPACE
if: env.debug_ci == 'true'
- name: DEBUG - Print all shell env exports
run: export -p
if: env.debug_ci == 'true'
- name: DEBUG - List workspace and Homebrew contents
run: |
ls -lAR ${GITHUB_WORKSPACE}
ls -lR /usr/local/Homebrew
if: env.debug_ci == 'true'
- name: Generate Brewfile from soloistrc test fixture
run: make brewfile
- name: DEBUG - Where are Brewfiles?
run: |
find ${GITHUB_WORKSPACE} -iname 'Brewfile*'
if: env.debug_ci == 'true'
- name: Configure Homebrew cache
uses: actions/cache@v3
with:
path: |
~/Library/Caches/Homebrew/*--*
~/Library/Caches/Homebrew/downloads/*--*
~/Library/Caches/Homebrew/Cask/*--*
/usr/local/Homebrew/Library/Taps/**
/opt/Homebrew/Library/Taps/**
./Brewfile.lock.json
key: brew-${{ matrix.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }}-${{ hashFiles( env.BREWFILE_PATH, '**/Brewfile.lock.json') }}
restore-keys: |
brew-${{ matrix.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }}-${{ hashFiles( env.BREWFILE_PATH, '**/Brewfile.lock.json') }}
brew-${{ matrix.os }}-${{ runner.arch }}-${{ hashFiles('.github/clear_github_actions_cache') }}
- name: Re-enable checksum offloading
# See: https://github.com/actions/virtual-environments/issues/1187#issuecomment-696195756
run: |
sudo sysctl -w net.link.generic.system.hwcksum_tx=1
sudo sysctl -w net.link.generic.system.hwcksum_rx=1
- name: Disable sprout-osx-settings::updates
run: |
sudo mkdir -p /var/chef/cache/
sudo touch /var/chef/cache/last_software_update
- name: Disable Homebrew Analytics
run: brew analytics off
- name: Run bootstrap.sh + soloist with test fixtures
run: |
make bootstrap
- name: Change ownership of root-owned files generated by chef-solo
run: |
sudo chown -R $(id -u):$(id -g) ${GITHUB_WORKSPACE}/test/fixtures/nodes
- name: DEBUG - Where are Brewfiles? (exclude nodes and vendor dirs)
run: |
find ${GITHUB_WORKSPACE} \( -type d -a \( -name '*/nodes' -o -name '*/vendor' \) -prune \) -o -iname 'Brewfile*'
if: env.debug_ci == 'true'