Skip to content

Commit

Permalink
Merge branch 'master' into fix-install-capi-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary authored Jan 9, 2024
2 parents 813c913 + ff335cb commit 8d4c65b
Show file tree
Hide file tree
Showing 1,057 changed files with 115,495 additions and 48,796 deletions.
10 changes: 10 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[profile.ci]
# Print out output for failing tests as soon as they fail, and also at the end
# of the run (for easy scrollability).
failure-output = "immediate-final"
# Do not cancel the test run on the first failure.
fail-fast = false
# Automatically mark a test as "slow" after 60 seconds, then kill it after 180s
slow-timeout = { period = "60s", terminate-after = 3 }
# Retry a couple times in case there are flaky tests
retries = 3
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/---bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Copy and paste the result of executing the following in your shell, so we can kn
-->

```sh
echo "`wasmer -V` | `rustc -V` | `uname -m`"
wasmer -vV; rustc -vV
```


Expand Down
11 changes: 0 additions & 11 deletions .github/codecov.yml

This file was deleted.

70 changes: 70 additions & 0 deletions .github/cross-linux-riscv64/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
FROM debian:stable AS openssl_riscv64
#FROM ghcr.io/cross-rs/riscv64gc-unknown-linux-gnu:edge AS openssl_riscv64

# set CROSS_DOCKER_IN_DOCKER to inform `cross` that it is executed from within a container
ENV CROSS_DOCKER_IN_DOCKER=true

RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends \
ca-certificates \
curl \
cpio \
sharutils \
gnupg \
build-essential \
libc6-dev

#COPY install_deb.sh /

#install libssl-dev for riscv64!
#RUN /install_deb.sh riscv64 libssl-dev
#RUN dpkg --add-architecture riscv64
#RUN apt-get update
#RUN apt-get install libssl-dev:riscv64
#ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include
#ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/riscv64-linux-gnu


# install rust tools
RUN curl --proto "=https" --tlsv1.2 --retry 3 -sSfL https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup -v toolchain install 1.70
# add docker the manual way
COPY install_docker.sh /
RUN /install_docker.sh

RUN apt-get update && \
apt-get install --assume-yes --no-install-recommends \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc-riscv64-linux-gnu \
g++-riscv64-linux-gnu \
qemu-user-static \
libssl-dev \
pkg-config \
libc6-dev-riscv64-cross

ENV CROSS_TOOLCHAIN_PREFIX=riscv64-linux-gnu-
ENV CROSS_SYSROOT=/usr/riscv64-linux-gnu
ENV CARGO_TARGET_RISCV64GC_UNKNOWN_LINUX_GNU_LINKER="$CROSS_TOOLCHAIN_PREFIX"gcc \
AR_riscv64gc_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"ar \
CC_riscv64gc_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"gcc \
CXX_riscv64gc_unknown_linux_gnu="$CROSS_TOOLCHAIN_PREFIX"g++ \
CFLAGS_riscv64gc_unknown_linux_gnu="-march=rv64gc -mabi=lp64d" \
BINDGEN_EXTRA_CLANG_ARGS_riscv64gc_unknown_linux_gnu="--sysroot=$CROSS_SYSROOT" \
QEMU_LD_PREFIX="$CROSS_SYSROOT" \
RUST_TEST_THREADS=1 \
PKG_CONFIG_PATH="/usr/lib/riscv64-linux-gnu/pkgconfig/:${PKG_CONFIG_PATH}"

RUN rustup target add riscv64gc-unknown-linux-gnu --toolchain 1.70-x86_64-unknown-linux-gnu

#compile libssl-dev for riscv64!
COPY build_openssl.sh /
RUN /build_openssl.sh
ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/openssl_riscv64/include
ENV RISCV64GC_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/openssl_riscv64/lib
17 changes: 17 additions & 0 deletions .github/cross-linux-riscv64/build_openssl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -x
set -euo pipefail

apt-get install wget

wget https://www.openssl.org/source/openssl-3.1.1.tar.gz

tar xf openssl-3.1.1.tar.gz
rm openssl-3.1.1.tar.gz
cd openssl-3.1.1

AR=riscv64-linux-gnu-ar NM=riscv64-linux-gnu-nm CC=riscv64-linux-gnu-gcc \
./Configure -static no-asm no-tests --prefix=/openssl_riscv64 linux64-riscv64

make -j
make install
57 changes: 57 additions & 0 deletions .github/cross-linux-riscv64/install_deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
set -x
set -euo pipefail

arch="${1}"
shift

# need to install certain local dependencies
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install --assume-yes --no-install-recommends \
ca-certificates \
curl \
cpio \
sharutils \
debian-ports-archive-keyring \
gnupg

# Add port from bookworm to get some riscv packages
debsource="deb http://deb.debian.org/debian-ports unstable main"

# temporarily use debian sources rather than ubuntu.
touch /etc/apt/sources.list
mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo -e "${debsource}" > /etc/apt/sources.list

dpkg --add-architecture "${arch}" || echo "foreign-architecture ${arch}" \
> /etc/dpkg/dpkg.cfg.d/multiarch

## Add Debian keys.
#curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{11,12}.asc' -O
#curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{11,12}-security.asc' -O
#curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/release-{11,12}.asc' -O
#curl --retry 3 -sSfL 'https://www.ports.debian.org/archive_{2023}.key' -O
#
#for key in *.asc *.key; do
# apt-key add "${key}"
# rm "${key}"
#done

# allow apt-get to retry downloads
echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries

apt-get update
for dep in $@; do
apt-get install "${dep}:${arch}" --assume-yes
done

# restore our old sources list
mv -f /etc/apt/sources.list.bak /etc/apt/sources.list
if [ -f /etc/dpkg/dpkg.cfg.d/multiarch.bak ]; then
mv /etc/dpkg/dpkg.cfg.d/multiarch.bak /etc/dpkg/dpkg.cfg.d/multiarch
fi

# can fail if arch is used (amd64 and/or i386)
dpkg --remove-architecture "${arch}" || true
apt-get update
11 changes: 11 additions & 0 deletions .github/cross-linux-riscv64/install_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -x
set -euo pipefail

mkdir -m 0755 -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
4 changes: 0 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,3 @@ https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->

# Review

- [ ] Add a short description of the change to the CHANGELOG.md file
44 changes: 44 additions & 0 deletions .github/s3-cache-cleanup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env python3

# Deletes all objects in an S3 bucket that are older than a given number of days.
# Used for cleaning up the custom Github Actions cache.

import boto3
import datetime
import os

# Define the S3 bucket name and the number of days to retain objects
days_to_retain = 7

bucket_name = os.environ['AWS_BUCKET_NAME']
access_key = os.environ['AWS_ACCESS_KEY_ID']
secret_key = os.environ['AWS_SECRET_ACCESS_KEY']
endpoint = os.environ['AWS_ENDPOINT']

# Create a connection to the S3 service
s3 = boto3.resource('s3',
endpoint_url = endpoint,
aws_access_key_id = access_key,
aws_secret_access_key = secret_key,
region_name = 'auto',
)

bucket = s3.Bucket(bucket_name)

# Calculate the retention date.
cutoff_date = (datetime.datetime.now() - datetime.timedelta(days=days_to_retain))
cutoff_date = cutoff_date.replace(tzinfo=datetime.timezone.utc)

print(f'Deleting all objects in bucket {bucket_name} older than {cutoff_date}...')

total_count = 0
deleted_count = 0

for obj in bucket.objects.all():
total_count += 1
if obj.last_modified < cutoff_date:
print(f'Deleting {obj.key}...')
obj.delete()
deleted_count += 1

print(f'Complete! Deleted {deleted_count} objects out of a total {total_count}.')
6 changes: 5 additions & 1 deletion .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- benchmark # TODO: change it back to master once we really track the results. We commented this as speed.wasmer.io is failing

env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
MSRV: "1.70"

jobs:
run_benchmark:
name: Benchmark on ${{ matrix.build }}
Expand All @@ -24,7 +28,7 @@ jobs:
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.63
toolchain: ${{ env.MSRV }}
- name: Configure cargo data directory
# After this point, all cargo registry and crate data is stored in
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
Expand Down
Loading

0 comments on commit 8d4c65b

Please sign in to comment.