Skip to content

Commit 885434f

Browse files
authored
Merge pull request #1174 from rajatjindal/fix-arm
allow running e2e tests with aarch64
2 parents 3167e6e + 9ba4803 commit 885434f

File tree

4 files changed

+54
-27
lines changed

4 files changed

+54
-27
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,4 +170,4 @@ jobs:
170170
- name: Run e2e tests
171171
run: |
172172
chmod +x `pwd`/target/release/spin
173-
docker compose -f e2e-tests-docker-compose.yml run e2e-tests
173+
docker compose -f e2e-tests-docker-compose.yml run -v `pwd`/target/release/spin:/usr/local/bin/spin e2e-tests

e2e-tests-aarch64.Dockerfile

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
FROM ubuntu:22.04
22

3+
ARG BUILD_SPIN=false
4+
ARG SPIN_VERSION=canary
5+
36
WORKDIR /root
47
RUN apt-get update && apt-get install -y wget sudo xz-utils gcc git pkg-config
58

@@ -21,42 +24,48 @@ RUN wget https://ziglang.org/download/0.10.0/zig-linux-aarch64-0.10.0.tar.xz &&
2124
tar -xf zig-linux-aarch64-0.10.0.tar.xz
2225
ENV PATH="$PATH:/root/zig-linux-aarch64-0.10.0"
2326

24-
# # grain
27+
# # grain - disabled as no arm build
2528
# RUN wget https://github.com/grain-lang/grain/releases/download/grain-v0.5.4/grain-linux-x64 && \
2629
# mv grain-linux-x64 /usr/local/bin/grain && chmod +x /usr/local/bin/grain
2730

28-
# spin
29-
RUN wget https://github.com/fermyon/spin/releases/download/canary/spin-canary-linux-aarch64.tar.gz && \
30-
tar -xvf spin-canary-linux-aarch64.tar.gz && \
31-
ls -ltr && \
32-
mv spin /usr/local/bin/spin
33-
3431
# # rust
3532
ENV RUSTUP_HOME=/usr/local/rustup \
3633
CARGO_HOME=/usr/local/cargo \
3734
PATH=/usr/local/cargo/bin:$PATH
3835

39-
RUN url="https://static.rust-lang.org/rustup/dist/aarch64-unknown-linux-gnu/rustup-init"; \
40-
wget "$url"; \
41-
chmod +x rustup-init; \
42-
./rustup-init -y --no-modify-path --default-toolchain 1.66 --default-host aarch64-unknown-linux-gnu; \
43-
rm rustup-init; \
44-
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
45-
rustup --version; \
46-
cargo --version; \
47-
rustc --version; \
36+
RUN url="https://static.rust-lang.org/rustup/dist/aarch64-unknown-linux-gnu/rustup-init"; \
37+
wget "$url"; \
38+
chmod +x rustup-init; \
39+
./rustup-init -y --no-modify-path --default-toolchain 1.66 --default-host aarch64-unknown-linux-gnu; \
40+
rm rustup-init; \
41+
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
42+
rustup --version; \
43+
cargo --version; \
44+
rustc --version; \
4845
rustup target add wasm32-wasi;
4946

5047
## check versions
51-
RUN tinygo version
52-
RUN go version
53-
# RUN grain --version
54-
RUN spin --version
55-
RUN zig version
56-
RUN rustc --version
57-
RUN node --version
48+
RUN tinygo version; \
49+
go version; \
50+
zig version; \
51+
rustc --version; \
52+
node --version;
5853

5954
WORKDIR /e2e-tests
6055
COPY . .
6156

57+
# spin
58+
RUN if [ "${BUILD_SPIN}" != "true" ]; then \
59+
wget https://github.com/fermyon/spin/releases/download/${SPIN_VERSION}/spin-${SPIN_VERSION}-linux-aarch64.tar.gz && \
60+
tar -xvf spin-${SPIN_VERSION}-linux-aarch64.tar.gz && \
61+
ls -ltr && \
62+
mv spin /usr/local/bin/spin; \
63+
else \
64+
cargo build --release && \
65+
cp target/release/spin /usr/local/bin/spin; \
66+
fi
67+
68+
RUN spin --version
69+
70+
6271
CMD cargo test spinup_tests --features new-e2e-tests --no-fail-fast -- --nocapture

e2e-tests-docker-compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: "3.9"
22

33
services:
44
mysql:
5-
image: mysql:8.0.22
5+
image: ${MYSQL_IMAGE:-mysql:8.0.22}
66
ports:
77
- "3306:3306"
88
volumes:
@@ -19,8 +19,6 @@ services:
1919
- mysql
2020
image: spin-e2e-tests
2121
entrypoint: cargo test spinup_tests --features new-e2e-tests --no-fail-fast -- --nocapture
22-
volumes:
23-
- ./target/release/spin:/usr/local/bin/spin
2422

2523
volumes:
2624
db_data: {}

tests/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,26 @@ docker build -t spin-e2e-tests -f e2e-tests.Dockerfile .
2020
docker compose -f e2e-tests-docker-compose.yml run e2e-tests
2121
```
2222

23+
## How to run e2e tests on aarch64
24+
```
25+
## go to root dir of the project, e2e-tests-aarch64.Dockerfile is located there
26+
docker build -t spin-e2e-tests -f e2e-tests-aarch64.Dockerfile .
27+
MYSQL_IMAGE=arm64v8/mysql:8.0.32 docker compose \
28+
-f e2e-tests-docker-compose.yml run \
29+
e2e-tests
30+
```
31+
32+
## How to use `spin` binary with your local changes
33+
34+
By default tests use the canary build of `spin` downloaded at docker image creation time. If you want to test it with your changes, you can use `--build-arg BUILD_SPIN=true`
35+
36+
```
37+
docker build --build-arg BUILD_SPIN=true -t spin-e2e-tests -f e2e-tests.Dockerfile .
38+
docker compose \
39+
-f e2e-tests-docker-compose.yml run \
40+
e2e-tests
41+
```
42+
2343
## Important files and their function
2444

2545
`crates/e2e-testing` - All the test framework/utilities that are required for `e2e-tests`

0 commit comments

Comments
 (0)