Skip to content

Commit

Permalink
try some update ci stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Jan 31, 2024
1 parent 53c9e26 commit 75c57c9
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 10 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
jobs:
library-unit:
name: Library (Unit Tests)
runs-on: ubuntu-latest
runs-on: warp-ubuntu-latest-x64-16x
steps:
- name: Checkout project sources
uses: actions/checkout@v3
Expand All @@ -24,15 +24,13 @@ jobs:
uses: gradle/gradle-build-action@v2
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Start local test server
run: docker-compose -p xmtp -f dev/local/docker-compose.yml up -d
- name: Start Docker containers
run: dev/up
- name: Gradle Run Unit Tests
run: ./gradlew library:testDebug
- name: Stop local test server
run: docker-compose -p xmtp -f dev/local/docker-compose.yml down
library-integration:
name: Library (Integration Tests)
runs-on: macos-latest
runs-on: warp-macos-latest-arm64-6x
steps:
- name: Checkout project sources
uses: actions/checkout@v3
Expand All @@ -48,13 +46,11 @@ jobs:
run: brew install docker docker-compose
- name: Start Colima
run: colima start
- name: Start local test server
run: docker-compose -p xmtp -f dev/local/docker-compose.yml up -d
- name: Start Docker containers
run: dev/up
- name: Gradle Run Integration Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: ./gradlew connectedCheck
- name: Stop local test server
run: docker-compose -p xmtp -f dev/local/docker-compose.yml down

16 changes: 16 additions & 0 deletions dev/build_validation_service_local
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env sh
set -eu

# Check if x86_64-linux-gnu-gcc is installed AND that the user is on a mac
if [ ! -x "$(command -v x86_64-linux-gnu-gcc)" ] && [ "$(uname)" = "Darwin" ]; then
echo "Installing cross compile toolchain"
brew tap messense/macos-cross-toolchains
brew install x86_64-unknown-linux-gnu
fi

rustup target add x86_64-unknown-linux-gnu
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc
cargo build --release --package mls_validation_service --target x86_64-unknown-linux-gnu
mkdir -p .cache
cp -f ./target/x86_64-unknown-linux-gnu/release/mls-validation-service ./.cache/mls-validation-service
docker build --platform=linux/amd64 -t xmtp/mls-validation-service:latest -f ./dev/validation_service/local.Dockerfile .
4 changes: 4 additions & 0 deletions dev/local/compose
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -eou pipefail

docker-compose -f dev/docker/docker-compose.yml -p "xmtp-android" "$@"
6 changes: 6 additions & 0 deletions dev/local/up
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -eou pipefail
script_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

"${script_dir}"/compose pull
"${script_dir}"/compose up -d --build
19 changes: 19 additions & 0 deletions dev/up
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
set -eou pipefail

if [[ "${OSTYPE}" == "darwin"* ]]; then
if ! which buf &>/dev/null; then brew install buf; fi
if ! which shellcheck &>/dev/null; then brew install shellcheck; fi
if ! which markdownlint &>/dev/null; then brew install markdownlint-cli; fi
if ! java -version &>/dev/null; then
brew install java
sudo ln -sfn /opt/homebrew/opt/openjdk/libexec/openjdk.jdk \
/Library/Java/JavaVirtualMachines/
fi
if ! kotlinc -version &>/dev/null; then brew install kotlin; fi
fi

rustup update

dev/build_validation_service_local
dev/local/up
10 changes: 10 additions & 0 deletions dev/validation_service/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM rust:1-bullseye as builder
WORKDIR /code
COPY . .
RUN cargo build --release --package mls_validation_service

FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y sqlite3
COPY --from=builder /code/target/release/mls-validation-service /usr/local/bin/mls-validation-service
ENV RUST_LOG=info
CMD ["mls-validation-service"]
5 changes: 5 additions & 0 deletions dev/validation_service/local.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM debian:stable-slim
RUN apt-get update && apt-get install -y sqlite3
COPY .cache/mls-validation-service /usr/local/bin/mls-validation-service
ENV RUST_LOG=info
CMD ["mls-validation-service"]

0 comments on commit 75c57c9

Please sign in to comment.