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

Add Arm64 Mac fallback support #23

Merged
merged 6 commits into from
Dec 30, 2021
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
77 changes: 47 additions & 30 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,19 @@ jobs:
- windows-latest
- macos-latest
- ubuntu-latest
# - macos-11 # arm64
d:
- "ldc-1.27.1"
- "ldc-1.28.0"
node:
- 16
pnpm:
- 6
clang:
- 12.0.0
compiler:
- llvm-12.0.0
cmake:
- 3.20.2
- "3.22.1"
ninja:
- 1.10.2
CC:
- clang
CXX:
- clang++
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
- "1.10.2"
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -49,40 +43,63 @@ jobs:
~/.pnpm-store
D:\.pnpm-store
./.dub
./llvm
C:/Program Files/LLVM
key: "cache-OS:${{ matrix.os }}-D:${{ matrix.d }}-Clang:${{ matrix.clang }}-dub:${{ hashFiles('./dub.selections.json')}}-pnpm:${{ hashFiles('./pnpm-lock.yaml') }}"
~/llvm
key: "cache-OS:${{ matrix.os }}-D:${{ matrix.d }}-CXX:${{ matrix.compiler }}-dub:${{ hashFiles('./dub.selections.json')}}-pnpm:${{ hashFiles('./pnpm-lock.yaml') }}"
restore-keys: |
"cache-OS:${{ matrix.os }}-D:${{ matrix.d }}-Clang:${{ matrix.clang }}"
"cache-OS:${{ matrix.os }}-D:${{ matrix.d }}-CXX:${{ matrix.compiler }}"

# Setup compilers and tools

- name: Setup LLVM
uses: KyleMayes/install-llvm-action@v1
with:
version: ${{ matrix.clang }}
cached: ${{ steps.cache.outputs.cache-hit }}

- name: Setup Cmake and Ninja
uses: aminya/install-cmake@new-versions-and-arch
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: ${{ matrix.compiler }}
cmake: ${{ matrix.cmake }}
ninja: ${{ matrix.ninja }}

- name: Setup D
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.d }}

- name: Setup Mac Arm64
shell: bash
if: contains(matrix.os, 'macos-11')
run: |
ARCH="arm64"
echo "ARCH=$ARCH" >> $GITHUB_ENV
echo "triple=$ARCH-apple-macos" >> $GITHUB_ENV
echo "DFLAGS='-mtriple=$triple -Xcc=target -Xcc=$ARCH-apple-macos'" >> $GITHUB_ENV
echo "CPPFLAGS=$CPPFLAGS -arch $ARCH" >> $GITHUB_ENV
echo "CFLAGS=$CFLAGS -arch $ARCH" >> $GITHUB_ENV
echo "LDFLAGS=$LDFLAGS -arch $ARCH" >> $GITHUB_ENV

# Manually install ldc
# Due to https://github.com/dlang-community/setup-dlang/issues/51
curl -LJO https://github.com/ldc-developers/ldc/releases/download/v1.28.0/ldc2-1.28.0-osx-$ARCH.tar.xz
tar -xf ldc2-1.28.0-osx-$ARCH.tar.xz
rm ldc2-1.28.0-osx-$ARCH.tar.xz

LDC_PATH="~/ldc"
mkdir -p $LDC_PATH
mv ldc2-1.28.0-osx-$ARCH $LDC_PATH

# Activate ldc
echo "LIBRARY_PATH=$LDC_PATH/lib${LIBRARY_PATH:+:}${LIBRARY_PATH:-}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LDC_PATH/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH:-}" >> $GITHUB_ENV
echo "PATH=$LDC_PATH/bin${PATH:+:}${PATH:-}" >> $GITHUB_ENV
echo "DMD=ldmd2" >> $GITHUB_ENV
echo "DC=ldc2" >> $GITHUB_ENV

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Setup Pnpm
uses: pnpm/action-setup@v2
with:
version: ${{ matrix.pnpm }}

- name: Setup D
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.d }}

# Build and Test

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ targetPath "./dist"
sourcePaths "./src/native"
importPaths "./src/native"

dependency "automem" version="~>0.6.6"
dependency "automem" version="0.6.7"
preGenerateCommands "git submodule update --init" # despacer download
dependency "despacer" path="./src/native/despacer/bindings/d"

Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@
"zip": "zip -9 -j ./dist/minijson-windows-x64.zip ./dist/win32-x64/minijson.exe && zip -9 -j ./dist/minijson-macos-x64.zip ./dist/darwin-x64/minijson && zip -9 -j ./dist/minijson-linux-x64.zip ./dist/linux-x64/minijson",
"prepublishOnly": "shx rm -rf ./dist/tsconfig.tsbuildinfo ./dist/build.*"
},
"dependencies": {
"jsonminify": "^0.4.2"
},
"devDependencies": {
"@types/jasmine": "^3.9.1",
"@types/node": "16.9.4",
"eslint-config-atomic": "^1.16.2",
"jasmine": "^3.9.0",
"@types/jasmine": "^3.10.2",
"@types/node": "17.0.5",
"eslint-config-atomic": "^1.16.5",
"jasmine": "^3.10.0",
"jasmine-spec-reporter": "^7.0.0",
"jsonminify": "^0.4.1",
"mjs-dirname": "^1.0.0",
"parcel": "^2.0.0-rc.0",
"prettier-config-atomic": "^2.0.5",
"parcel": "^2.0.1",
"prettier-config-atomic": "^3.0.1",
"servor": "^4.0.2",
"shx": "0.3.3",
"strip-json-comments": "^4.0.0"
Expand Down Expand Up @@ -100,4 +102,4 @@
"rust",
"bandwith"
]
}
}
Loading