Skip to content

Commit 20933b8

Browse files
authored
Try #1831:
2 parents 1892e75 + 7d4853b commit 20933b8

File tree

22 files changed

+507
-350
lines changed

22 files changed

+507
-350
lines changed

.github/workflows/main.yaml

+61-56
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
strategy:
3939
fail-fast: false
4040
matrix:
41-
build: [linux, macos, windows, linux-aarch64]
41+
build: [linux, macos, macos-arm64, windows, linux-aarch64]
4242
include:
4343
- build: linux
4444
os: ubuntu-18.04
@@ -55,6 +55,11 @@ jobs:
5555
artifact_name: 'wasmer-macos-amd64'
5656
cross_compilation_artifact_name: 'cross_compiled_from_mac'
5757
run_integration_tests: true
58+
- build: macos-arm64
59+
os: macos-11.0
60+
rust: nightly
61+
target: aarch64-apple-darwin
62+
artifact_name: 'wasmer-macos-arm64'
5863
- build: windows
5964
os: windows-latest
6065
rust: 1.47.0
@@ -83,42 +88,16 @@ jobs:
8388
uses: actions-rs/toolchain@v1
8489
with:
8590
toolchain: ${{ matrix.rust }}
91+
target: ${{ matrix.target }}
8692
override: true
87-
- name: Configure cargo data directory
88-
# After this point, all cargo registry and crate data is stored in
89-
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
90-
# that are needed during the build process. Additionally, this works
91-
# around a bug in the 'cache' action that causes directories outside of
92-
# the workspace dir to be saved/restored incorrectly.
93-
run: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
94-
- name: Cache
95-
uses: actions/cache@master
96-
with:
97-
# Note: crates from the git repo always get rebuilt
98-
# so we cache only those subdirectories of target/{debug|release} that
99-
# contain the build output for crates that come from the registry.
100-
path: |-
101-
.cargo_home
102-
target/*/.*
103-
target/*/build
104-
target/*/deps
105-
key: ${{ matrix.os }}-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }}
106-
restore-keys: |
107-
${{ matrix.os }}-${{ matrix.rust }}-
108-
# # Install sccache
109-
# - uses: actions/cache@master
110-
# with:
111-
# path: ${{ runner.tool_cache }}/cargo-sccache
112-
# key: cargo-sccache-bin-${{ env.CARGO_SCCACHE_VERSION }}
113-
# - name: Install sccache
114-
# run: |
115-
# echo "${{ runner.tool_cache }}/cargo-sccache/bin" >> $GITHUB_PATH
116-
# cargo install sccache --version ${{ env.CARGO_SCCACHE_VERSION }} --root ${{ runner.tool_cache }}/cargo-sccache
117-
# - name: Start sccache
118-
# run: |
119-
# ${{ runner.tool_cache }}/cargo-sccache/bin/sccache --start-server
120-
# ${{ runner.tool_cache }}/cargo-sccache/bin/sscache -s
121-
# echo "RUSTC_WRAPPER=${{ runner.tool_cache }}/cargo-sccache/bin/sccache" >> $GITHUB_ENV
93+
- name: Setup Rust target
94+
run: |
95+
cat << EOF > .cargo/config.toml
96+
[build]
97+
target = "${{ matrix.target }}"
98+
EOF
99+
if: matrix.target
100+
- uses: Swatinem/rust-cache@v1
122101
- name: Install LLVM (Windows)
123102
if: matrix.os == 'windows-latest'
124103
shell: cmd
@@ -131,7 +110,7 @@ jobs:
131110
# echo "LLVM_SYS_100_PREFIX=C:/llvm-10" >> $GITHUB_ENV
132111
# echo "LIBCLANG_PATH=C:/llvm-10/bin/libclang.dll" >> $GITHUB_ENV
133112
- name: Install LLVM (Unix)
134-
if: matrix.os != 'windows-latest'
113+
if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-apple-darwin'
135114
run: |
136115
curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.llvm_url }} -L -o llvm.tar.xz
137116
mkdir -p ${{ env.LLVM_DIR }}
@@ -141,14 +120,25 @@ jobs:
141120
env:
142121
LLVM_DIR: ${{ github.workspace }}/llvm-10
143122
- name: Set up dependencies for Mac OS
144-
run: brew install automake
145-
if: matrix.os == 'macos-latest'
146-
- run: make test
147-
- name: Build and Test C API
123+
run: |
124+
brew install automake
125+
if: matrix.os == 'macos-latest' || matrix.os == 'macos-11.0'
126+
- name: Test
127+
run: |
128+
make test
129+
if: matrix.target != 'aarch64-apple-darwin'
130+
- name: Test C API
148131
run: |
149132
make test-capi
133+
if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-apple-darwin' # we can't test yet on Apple Silicon or Windows
134+
- name: Build C API
135+
run: |
150136
make build-capi
151-
if: matrix.os != 'windows-latest'
137+
if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-apple-darwin'
138+
- name: Build C API
139+
run: |
140+
make build-capi-cranelift-system-libffi
141+
if: matrix.target == 'aarch64-apple-darwin'
152142
- name: Build C API on Windows
153143
run: make build-capi
154144
if: matrix.os == 'windows-latest'
@@ -158,14 +148,20 @@ jobs:
158148
- name: Build Wapm binary
159149
run: |
160150
make build-wapm
161-
if: needs.setup.outputs.DOING_RELEASE == '1'
162-
- name: Package Wasmer for integration tests
163-
run: make package-without-wapm-for-integration-tests
164-
if: needs.setup.outputs.DOING_RELEASE != '1'
165-
- name: Package Wasmer
151+
# if: needs.setup.outputs.DOING_RELEASE == '1'
152+
- name: Copy target binaries
166153
run: |
167-
make package
168-
if: needs.setup.outputs.DOING_RELEASE == '1'
154+
mkdir -p target/release
155+
cp target/${{matrix.target}}/release/wasmer* target/release
156+
cp target/${{matrix.target}}/release/libwasmer* target/release
157+
if [ -d "wapm-cli" ]; then
158+
mkdir -p wapm-cli/target/release
159+
cp wapm-cli/target/${{matrix.target}}/release/wapm* wapm-cli/target/release
160+
fi
161+
if: matrix.target
162+
- name: Dist
163+
run: |
164+
make distribution
169165
- name: Run integration tests (Windows)
170166
shell: cmd
171167
run: |
@@ -220,7 +216,6 @@ jobs:
220216
path: cross
221217
- name: Upload Artifacts
222218
uses: actions/upload-artifact@v2
223-
if: needs.setup.outputs.DOING_RELEASE == '1'
224219
with:
225220
name: ${{ matrix.artifact_name }}
226221
path: dist
@@ -300,7 +295,7 @@ jobs:
300295
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
301296
with:
302297
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
303-
asset_path: artifacts/wasmer-windows-amd64/wasmer-windows.exe
298+
asset_path: artifacts/wasmer-windows-amd64/WasmerInstaller.exe
304299
asset_name: wasmer-windows.exe
305300
asset_content_type: application/vnd.microsoft.portable-executable
306301
- name: Upload Release Asset Linux amd64
@@ -310,27 +305,37 @@ jobs:
310305
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
311306
with:
312307
upload_url: ${{ steps.create_release.outputs.upload_url }}
313-
asset_path: artifacts/wasmer-linux-amd64/wasmer-linux-amd64.tar.gz
308+
asset_path: artifacts/wasmer-linux-amd64/wasmer.tar.gz
314309
asset_name: wasmer-linux-amd64.tar.gz
315310
asset_content_type: application/gzip
316-
- name: Upload Release Asset Mac
317-
id: upload-release-asset-mac
311+
- name: Upload Release Asset Mac amd64
312+
id: upload-release-asset-mac-amd64
318313
uses: actions/upload-release-asset@v1
319314
env:
320315
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
321316
with:
322317
upload_url: ${{ steps.create_release.outputs.upload_url }}
323-
asset_path: artifacts/wasmer-macos-amd64/wasmer-darwin-amd64.tar.gz
318+
asset_path: artifacts/wasmer-macos-amd64/wasmer.tar.gz
324319
asset_name: wasmer-darwin-amd64.tar.gz
325320
asset_content_type: application/gzip
321+
- name: Upload Release Asset Mac arm64
322+
id: upload-release-asset-mac-arm64
323+
uses: actions/upload-release-asset@v1
324+
env:
325+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
326+
with:
327+
upload_url: ${{ steps.create_release.outputs.upload_url }}
328+
asset_path: artifacts/wasmer-macos-amd64/wasmer.tar.gz
329+
asset_name: wasmer-darwin-arm64.tar.gz
330+
asset_content_type: application/gzip
326331
- name: Upload Release Asset Linux aarch64
327332
id: upload-release-asset-linux-aarch64
328333
uses: actions/upload-release-asset@v1
329334
env:
330335
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
331336
with:
332337
upload_url: ${{ steps.create_release.outputs.upload_url }}
333-
asset_path: artifacts/wasmer-linux-aarch64/wasmer-linux-aarch64.tar.gz
338+
asset_path: artifacts/wasmer-linux-aarch64/wasmer.tar.gz
334339
asset_name: wasmer-linux-aarch64.tar.gz
335340
asset_content_type: application/gzip
336341

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
### Added
1111

12+
- [#1831](https://github.com/wasmerio/wasmer/pull/1831) Added support for Apple Silicon chips (`arm64-apple-darwin`)
1213
- [#1649](https://github.com/wasmerio/wasmer/pull/1649) Add outline of migration to 1.0.0 docs.
1314

1415
### Changed

0 commit comments

Comments
 (0)