forked from timsutton/brew-pkg
-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (143 loc) · 5.62 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
name: MetaCall Brew PKG Test
on:
workflow_dispatch:
pull_request:
push:
tags:
- 'v*.*.*'
branches:
- master
- develop
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build Test Distributable
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14] # TODO: Add macos-12
runs-on: ${{ matrix.os }}
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# Clean up previous dependencies in order to avoid conflicts with brew
- name: Uninstall brew completely
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
- name: Install brew
run: |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew uninstall --force --ignore-dependencies node
brew cleanup -s node
brew cleanup --prune-prefix
brew uninstall --force --ignore-dependencies [email protected]
brew cleanup -s [email protected]
brew cleanup --prune-prefix
brew uninstall --force --ignore-dependencies [email protected]
brew cleanup -s [email protected]
brew cleanup --prune-prefix
sudo rm -rf /System/Library/Frameworks/Python.framework/
brew cleanup --prune-prefix
sudo rm -rf /usr/local/bin/2to3
sudo rm -rf /usr/local/bin/2to3-3.11
sudo rm -rf /usr/local/bin/2to3-3.12
sudo rm -rf /usr/local/bin/idle3
sudo rm -rf /usr/local/bin/idle3.11
sudo rm -rf /usr/local/bin/idle3.12
sudo rm -rf /usr/local/bin/pydoc3
sudo rm -rf /usr/local/bin/pydoc3.11
sudo rm -rf /usr/local/bin/pydoc3.12
sudo rm -rf /usr/local/bin/python3
sudo rm -rf /usr/local/bin/python3-config
sudo rm -rf /usr/local/bin/python3.11
sudo rm -rf /usr/local/bin/python3.12
sudo rm -rf /usr/local/bin/python3.11-config
sudo rm -rf /usr/local/bin/python3.12-config
brew uninstall --force --ignore-dependencies ruby
brew cleanup -s ruby
brew cleanup --prune-prefix
sudo rm -rf $(brew --repo homebrew/core)
- name: Test
run: ./test.sh
- name: Create the distributable folder
run: |
mkdir -p distributable
mv ruby-with-python.pkg distributable/
mv ruby-with-python.tgz distributable/
# Upload build artifact
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: metacall-tarball-${{ matrix.os }}
path: distributable/*
tgz-test:
name: Run Test Distributable TGZ (relocatable)
needs: build
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14] # TODO: Add macos-12
runs-on: ${{ matrix.os }}
steps:
# Clean up previous dependencies in order to avoid conflicts with brew
- name: Uninstall brew completely
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
- name: Download the artifact
uses: actions/download-artifact@v4
with:
name: metacall-tarball-${{ matrix.os }}
# Test the package in a clean environment
- name: Test
run: |
mkdir distributable
tar -xvzf ruby-with-python.tgz -C `pwd`/distributable
DARWIN_VERSION=$(sw_vers -productVersion | cut -d '.' -f 1)
if [ "$(uname -m)" = "arm64" ]; then
INSTALL_DIR="`pwd`/distributable/opt/homebrew"
RUBY_PLATFORM_PAIR="arm64-darwin${DARWIN_VERSION}"
else
INSTALL_DIR="`pwd`/distributable/usr/local"
RUBY_PLATFORM_PAIR="x86_64-darwin${DARWIN_VERSION}"
fi
export PATH="${INSTALL_DIR}/bin:$PATH"
export RUBYLIB="${INSTALL_DIR}/lib/ruby/3.3.0:${INSTALL_DIR}/lib/ruby/3.3.0/${RUBY_PLATFORM_PAIR}"
export GEM_PATH="${INSTALL_DIR}/lib/ruby/gems/3.3.0"
otool -L ${INSTALL_DIR}/bin/python3
otool -L ${INSTALL_DIR}/Cellar/[email protected]/3.12.5/Frameworks/Python.framework/Versions/3.12/Python || true
otool -L ${INSTALL_DIR}/bin/ruby
${INSTALL_DIR}/bin/python3 -c 'import sys; print(sys.argv)'
${INSTALL_DIR}/bin/ruby -e "require 'date'; puts Date.today"
pkg-test:
name: Run Test Distributable PKG
needs: build
strategy:
fail-fast: false
matrix:
os: [macos-13, macos-14] # TODO: Add macos-12
runs-on: ${{ matrix.os }}
steps:
# Clean up previous dependencies in order to avoid conflicts with brew
- name: Uninstall brew completely
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
- name: Download the artifact
uses: actions/download-artifact@v4
with:
name: metacall-tarball-${{ matrix.os }}
# Test the package in a clean environment
- name: Test
run: |
mkdir distributable
lsbom $(pkgutil --bom ruby-with-python.pkg)
sudo installer -pkg "ruby-with-python.pkg" -target /
if [ "$(uname -m)" = "arm64" ]; then
INSTALL_DIR="/opt/homebrew"
else
INSTALL_DIR="/usr/local"
fi
otool -L ${INSTALL_DIR}/bin/python3
otool -L ${INSTALL_DIR}/bin/ruby
${INSTALL_DIR}/bin/python3 -c 'import sys; print(sys.argv)'
${INSTALL_DIR}/bin/ruby -e "require 'date'; puts Date.today"