Skip to content
Closed
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
65 changes: 65 additions & 0 deletions .github/workflows/auto-test-from-image-hb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Run HyperBEAM Tests, from docker image

on:
workflow_dispatch:
pull_request:
branches:
- main
types:
- opened

jobs:
build-deps-image:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build Erlang 27 image with deps and HyperBEAM
run: |
# set defaults if not in a PR
if [ "${GITHUB_EVENT_NAME}" != "pull_request" ]; then
echo "REPO_URL=https://github.com/permaweb/HyperBEAM.git" >> $GITHUB_ENV
echo "PR_BRANCH=main" >> $GITHUB_ENV
else
echo "REPO_URL=${{ github.event.pull_request.head.repo.clone_url }}" >> $GITHUB_ENV
echo "PR_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
fi

docker build --platform=linux/amd64 \
--build-arg REPO_URL="$REPO_URL" \
--build-arg PR_BRANCH="$PR_BRANCH" \
-t hyperbeam-deps - <<'EOF'
FROM erlang:27@sha256:b0edce60779cecafd65c1584d2475850f9840460e872d149e1159743a4098d47

ARG REPO_URL
ARG PR_BRANCH

# Install OS packages (git, build tools, etc.)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
build-essential \
cmake \
pkg-config \
ncurses-dev \
libssl-dev \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# (Optional) install Rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain stable \
&& echo 'export PATH=/root/.cargo/bin:$PATH' >> /etc/profile

RUN mkdir -p /hyperbeam

RUN git clone --depth 1 --branch "$PR_BRANCH" "$REPO_URL" /hyperbeam/HyperBEAM

EOF

- name: Run Tests
run: |
docker run --rm hyperbeam-deps bash -lc "cd /hyperbeam/HyperBEAM && rebar3 eunit"
89 changes: 89 additions & 0 deletions .github/workflows/auto-test-hb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Run HyperBEAM Tests

on:
workflow_dispatch:
pull_request:
branches:
- main
types:
- opened

jobs:
build-deps-image:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build Ubuntu 22.04 image with dependencies, and HyperBEAM
run: |
# set defaults if not in a PR
if [ "${GITHUB_EVENT_NAME}" != "pull_request" ]; then
echo "REPO_URL=https://github.com/permaweb/HyperBEAM.git" >> $GITHUB_ENV
echo "PR_BRANCH=main" >> $GITHUB_ENV
else
echo "REPO_URL=${{ github.event.pull_request.head.repo.clone_url }}" >> $GITHUB_ENV
echo "PR_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
fi

docker build --platform=linux/amd64 \
--build-arg REPO_URL="$REPO_URL" \
--build-arg PR_BRANCH="$PR_BRANCH" \
-t hyperbeam-deps - <<'EOF'
FROM ubuntu:22.04

ARG REPO_URL
ARG PR_BRANCH

# 1) Install OS packages (including git)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
build-essential \
cmake \
pkg-config \
ncurses-dev \
libssl-dev \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# 2) Build & install Erlang OTP 27
RUN git clone https://github.com/erlang/otp.git /tmp/otp \
&& cd /tmp/otp \
&& git checkout maint-27 \
&& ./configure \
&& make -j"$(nproc)" \
&& make install \
&& rm -rf /tmp/otp

# 3) Install rebar3
RUN git clone https://github.com/erlang/rebar3.git /tmp/rebar3 \
&& cd /tmp/rebar3 \
&& ./bootstrap \
&& mv rebar3 /usr/local/bin/ \
&& rm -rf /tmp/rebar3

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain stable


RUN mkdir -p /hyperbeam \
&& git clone --depth 1 --branch "$PR_BRANCH" "$REPO_URL" /hyperbeam/HyperBEAM

EOF


- name: Run Tests
run: |
docker run --rm hyperbeam-deps bash -lc "cd /hyperbeam/HyperBEAM && rebar3 eunit"

- name: Notify Slack on Failure
if: failure()
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' --data "{
\"text\": \":x: *HyperBEAM Tests Failed*\n*PR #${{ github.event.pull_request.number }}*: ${{ github.event.pull_request.title }}\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View test output>\"
}" \"$SLACK_WEBHOOK_URL\"
54 changes: 54 additions & 0 deletions .github/workflows/test-pre-built-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Run HyperBEAM Tests, pre built action

on:
workflow_dispatch:
pull_request:
branches:
- main
types:
- opened

jobs:
test:
runs-on: ubuntu-24.04
name: Install Deps and Run Tests
strategy:
matrix:
otp: ['27.3.3']
rebar3: ['3.24.0']
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Erlang & rebar3
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
rebar3-version: ${{ matrix.rebar3 }}

- name: Run EUnit
run: rebar3 eunit

- name: Notify Slack on Failure
if: failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
# Determine whether we're in a PR or a push to main
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then
TEXT=":x: HyperBEAM tests failed PR #${PR_NUMBER}: ${PR_TITLE}"
else
TEXT=":x: HyperBEAM tests failed on main"
fi

# Post to Slack
curl -X POST https://slack.com/api/chat.postMessage \
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
-d "channel=$SLACK_CHANNEL_ID" \
-d "text=${TEXT} <${RUN_URL}|View test output>"


3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,5 +297,4 @@ HyperBEAM is developed as an open source implementation of the AO-Core protocol
by [Forward Research](https://fwd.arweave.net). Pull Requests are always welcome!

To get started building on HyperBEAM, check out the [hacking on HyperBEAM](./docs/misc/hacking-on-hyperbeam.md)
guide.

guide.
1 change: 1 addition & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
Loading