Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have ci run on both macos and linux systems #10

Merged
merged 7 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ permissions:
jobs:
build:
name: build
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- name: checkout
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ permissions:
jobs:
lint:
name: lint
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- name: checkout
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ permissions:
jobs:
test:
name: test
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- name: checkout
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
tmp/
bin/
!vendor/bin/
!vendor/ci/bin/
!vendor/darwin_arm64/bin/
!vendor/darwin_x86_64/bin/
!vendor/linux_x86_64/bin/
.shards/
*.dwarf
dist/
Expand Down
41 changes: 38 additions & 3 deletions script/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,46 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )"
VENDOR_DIR="$DIR/vendor"
SHARDS_INSTALL_PATH="$VENDOR_DIR/shards/install"

LINUX_VENDOR_DIR="$VENDOR_DIR/linux_x86_64/bin"
DARWIN_VENDOR_DIR_X64="$VENDOR_DIR/darwin_x86_64/bin"
DARWIN_VENDOR_DIR_ARM64="$VENDOR_DIR/darwin_arm64/bin"

mkdir -p "$DIR/bin"

if [[ "$@" == *"--ci"* ]]; then
echo "copying vendored ci binaries"
cp -r "$VENDOR_DIR/ci/bin/." "$DIR/bin"
flags="$@"

if [[ "$flags" == *"--ci"* ]]; then
echo $OSTYPE
echo $(uname -m)
fi

# Determine if the system is a Mac or Linux
os="unknown"
arch="unknown"
if [[ "$OSTYPE" == "linux-gnu" ]]; then
os="linux"
if [[ "$flags" == *"--ci"* ]]; then
echo "OSTYPE: $OSTYPE"
echo "running in CI mode, copying vendored binaries to bin/ directory (linux)"
cp -r "$LINUX_VENDOR_DIR/." "$DIR/bin"
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
os="mac"
arch=$(uname -m)
if [[ "$flags" == *"--ci"* ]]; then
echo "OSTYPE: $OSTYPE"
echo "ARCH: $arch"
echo "running in CI mode, copying vendored binaries to bin/ directory (mac)"
if [ "$arch" = "x86_64" ]; then
cp -r "$DARWIN_VENDOR_DIR_X64/." "$DIR/bin"
elif [ "$arch" = "arm64" ]; then
cp -r "$DARWIN_VENDOR_DIR_ARM64/" "$DIR/bin"
else
echo "Unknown architecture: $arch"
fi
fi
else
os="unknown"
fi

if [[ ! "$@" == *"--production"* ]]; then
Expand Down
Binary file added vendor/darwin_arm64/bin/ameba
Binary file not shown.
Binary file added vendor/darwin_x86_64/bin/ameba
Binary file not shown.
File renamed without changes.