Skip to content

Commit

Permalink
Update test_release to match release workflow again
Browse files Browse the repository at this point in the history
  • Loading branch information
MexicanAce committed Sep 5, 2023
1 parent a109291 commit 1d9f625
Showing 1 changed file with 74 additions and 49 deletions.
123 changes: 74 additions & 49 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,72 +12,97 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:
name: build release
strategy:
matrix:
arch: [x86_64-unknown-linux-gnu]
include:
- arch: x86_64-unknown-linux-gnu
platform: ubuntu-20.04

runs-on: ${{ matrix.platform }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Get latest version of stable Rust
run: rustup update stable
- name: Install target
run: rustup target add ${{ matrix.arch }}
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

# ==============================
# Builds
# ==============================
- name: Build era-test-node for ${{ matrix.arch }}
run: |
cargo install cross
make build-${{ matrix.arch }}
- name: Rename and move binary
run: |
mkdir artifacts
mv target/${{ matrix.arch }}/release/era_test_node ./artifacts
- name: Create artifacts
run: |
cd artifacts
tar -czf era_test_node-${{ matrix.arch }}.tar.gz era_test_node*
mv *tar.gz* ..
# =======================================================================
# Upload artifacts
# This is required to share artifacts between different jobs
# =======================================================================
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: era_test_node-${{ matrix.arch }}.tar.gz
path: era_test_node-${{ matrix.arch }}.tar.gz

- name: Upload signature
uses: actions/upload-artifact@v3
with:
name: era_test_node-${{ matrix.arch }}.tar.gz.asc
path: era_test_node-${{ matrix.arch }}.tar.gz.asc

test-package:
name: validate test release
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Generate Dockerfile
uses: 1arp/create-a-file-action@0.2
with:
file: 'Dockerfile'
content: |
# Use Ubuntu 18.04 as the base image with x86_64
FROM ubuntu:18.04@sha256:dca176c9663a7ba4c1f0e710986f5a25e672842963d95b960191e2d9f7185ebe
# Install necessary dependencies
RUN apt-get update && \
apt-get install -y wget curl gnupg2 && \
echo "deb http://security.ubuntu.com/ubuntu bionic-security main" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install -y libssl1.0.0 && \
apt-get install -y cmake pkg-config clang socat
# Fetch and extract the era_test_node binary
RUN wget https://github.com/matter-labs/era-test-node/releases/download/v0.1.0/era_test_node-v0.1.0-x86_64-unknown-linux-gnu.tar.gz \
&& tar -xzf era_test_node-v0.1.0-x86_64-unknown-linux-gnu.tar.gz \
&& mv era_test_node /usr/local/bin/ \
&& rm era_test_node-v0.1.0-x86_64-unknown-linux-gnu.tar.gz
# Copy the start script
COPY start_script.sh /start_script.sh
# Make the start script executable
RUN chmod +x /start_script.sh
# Set the start script as the entry point
ENTRYPOINT ["/start_script.sh"]
- name: Generate start_script
uses: 1arp/create-a-file-action@0.2
# ==============================
# Download artifacts
# ==============================
- name: Download artifacts
uses: actions/download-artifact@v3
with:
file: 'start_script.sh'
content: |
#!/bin/bash
socat TCP-LISTEN:'8011',fork,reuseaddr TCP:127.0.0.1:3051 &
era_test_node --port 3051 run &
wait
- name: Build era_test_node_image Docker image
run: docker build -t era_test_node_image .

- name: Run era_test_node_image Docker container
run: docker run -d --name era_test_node_container -p 8011:8011 era_test_node_image
name: era_test_node-x86_64-unknown-linux-gnu.tar.gz

- name: Start the era_test_node
id: start_node
run: |
echo "Extracting era_test_node binary"
tar -xzf era_test_node-x86_64-unknown-linux-gnu.tar.gz
chmod +x era_test_node
echo "Starting node in background"
./era_test_node run 2>&1 | tee era_test_node_ouput.log &
echo "PID=$!" >> $GITHUB_ENV
- name: Launch tests
id: launch
run: |
echo "Run tests"
make test-e2e
- name: Stop the era_test_node and print output logs
id: stop_node
if: always()
run: |
docker logs era_test_node_container
docker stop era_test_node_container
cat era_test_node_ouput.log
kill $PID

0 comments on commit 1d9f625

Please sign in to comment.