2020-09-09 15:49:35 +00:00
|
|
|
name: Docker Build
|
|
|
|
|
|
|
|
on: [pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Run docker build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Run docker build
|
|
|
|
run: make docker-build
|
2021-02-19 20:23:45 +00:00
|
|
|
test:
|
2021-04-19 11:24:58 +00:00
|
|
|
name: Run unit tests
|
2021-02-19 20:23:45 +00:00
|
|
|
env:
|
|
|
|
GOPATH: /tmp/go
|
2022-04-18 20:42:20 +00:00
|
|
|
BUILD_HOSTNAME: ${{ secrets.BUILD_HOSTNAME }}
|
|
|
|
BUILD_USERNAME: ${{ secrets.BUILD_USERNAME }}
|
|
|
|
BUILD_KEY: ${{ secrets.BUILD_KEY }}
|
|
|
|
BUILD_PASSWORD: ${{ secrets.BUILD_PASSWORD}}
|
2021-02-19 20:23:45 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-10-11 16:24:05 +00:00
|
|
|
go-version: [1.16.x, 1.17.x]
|
2022-04-18 20:20:41 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-02-19 20:23:45 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2022-04-18 20:20:41 +00:00
|
|
|
|
|
|
|
# Passed experience with GHA has taught me to store variables in files instead of passing them as variables.
|
2022-04-18 20:35:44 +00:00
|
|
|
- name: Output variables
|
2022-04-18 20:20:41 +00:00
|
|
|
run: |
|
2022-04-18 21:01:34 +00:00
|
|
|
echo ${{ env.GITHUB_REPOSITORY }} > /tmp/git_repository
|
|
|
|
echo ${{ env.GITHUB_HEAD_REF }} > /tmp/git_head_ref
|
2022-04-18 20:42:20 +00:00
|
|
|
# echo ${{ env.BUILD_KEY }} | tr '\n' ''| sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin /tmp/git_repository {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_repository
|
|
|
|
# echo ${{ env.BUILD_KEY }} | tr '\n' ''| sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin /tmp/git_head_ref {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_head_ref
|
|
|
|
# echo ${{ env.BUILD_KEY }} | tr '\n' ''| sshpass -p ${{ env.BUILD_PASSWORD }} scp -i /dev/stdin ./github/workflows/run_unit_test.sh {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/run_unit_test.sh
|
2022-04-18 20:35:44 +00:00
|
|
|
|
|
|
|
- name: SCP some files
|
|
|
|
uses: appleboy/scp-action@master
|
|
|
|
with:
|
2022-04-18 20:42:20 +00:00
|
|
|
host: ${{ env.BUILD_HOSTNAME }}
|
2022-04-18 20:43:23 +00:00
|
|
|
username: ${{ env.BUILD_USERNAME }}
|
2022-04-18 20:42:20 +00:00
|
|
|
key: ${{ env.BUILD_KEY }}
|
2022-04-18 20:35:44 +00:00
|
|
|
port: 22
|
|
|
|
source: "/tmp/git_repository,/tmp/git_head_ref,./github/workflows/run_unit_test.sh"
|
|
|
|
target: "/tmp/"
|
2022-04-18 20:20:41 +00:00
|
|
|
|
|
|
|
- name: Trigger Unit Test
|
2022-04-18 21:01:34 +00:00
|
|
|
uses: appleboy/ssh-action@master
|
|
|
|
with:
|
|
|
|
host: ${{ env.BUILD_HOSTNAME }}
|
|
|
|
username: ${{ env.BUILD_USERNAME }}
|
|
|
|
key: ${{ env.BUILD_KEY }}
|
|
|
|
port: 22
|
|
|
|
script: /tmp/run_unit_test.sh
|
2022-04-18 20:20:41 +00:00
|
|
|
|
|
|
|
- name: Get the logs and cat them
|
|
|
|
run: |
|
2022-04-18 21:01:34 +00:00
|
|
|
echo ${{ env.BUILD_KEY }} | scp -i /dev/stdin {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/test.log .
|
2022-04-18 20:20:41 +00:00
|
|
|
cat ./test.log
|
|
|
|
|
|
|
|
- name: Check Error Code
|
2021-02-19 20:23:45 +00:00
|
|
|
run: |
|
2022-04-18 21:01:34 +00:00
|
|
|
echo ${{ env.BUILD_KEY }} | scp -i /dev/stdin {{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/return_test.txt .
|
2022-04-18 20:20:41 +00:00
|
|
|
[ $(cat ./return_test.txt) -eq 0 ]
|
2021-04-19 11:43:21 +00:00
|
|
|
|
|
|
|
integrationtest:
|
|
|
|
name: Run integration tests
|
|
|
|
env:
|
|
|
|
GOPATH: /tmp/go
|
2021-12-29 21:02:56 +00:00
|
|
|
DB_WRITE: true
|
|
|
|
ETH_FORWARD_ETH_CALLS: false
|
2021-12-30 02:29:59 +00:00
|
|
|
ETH_PROXY_ON_ERROR: false
|
|
|
|
ETH_HTTP_PATH: ""
|
2021-04-19 11:43:21 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2021-10-11 16:24:05 +00:00
|
|
|
go-version: [1.16.x]
|
2021-04-19 11:43:21 +00:00
|
|
|
os: [ubuntu-latest]
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Create GOPATH
|
|
|
|
run: mkdir -p /tmp/go
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Run database
|
2021-10-09 12:00:33 +00:00
|
|
|
run: docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db dapptools contract eth-server
|
2021-04-19 11:43:21 +00:00
|
|
|
- name: Test
|
|
|
|
run: |
|
2021-04-19 20:07:38 +00:00
|
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8081)" != "200" ]; do echo "waiting for ipld-eth-server..." && sleep 5; done && \
|
|
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \
|
2021-04-19 11:43:21 +00:00
|
|
|
make integrationtest
|
2021-12-29 21:02:56 +00:00
|
|
|
|
|
|
|
integrationtest_forwardethcalls:
|
2021-12-29 21:20:12 +00:00
|
|
|
name: Run integration tests for direct proxy fall-through of eth_calls
|
2021-12-29 21:02:56 +00:00
|
|
|
env:
|
|
|
|
GOPATH: /tmp/go
|
|
|
|
DB_WRITE: false
|
|
|
|
ETH_FORWARD_ETH_CALLS: true
|
2021-12-30 02:29:59 +00:00
|
|
|
ETH_PROXY_ON_ERROR: false
|
|
|
|
ETH_HTTP_PATH: "dapptools:8545"
|
2021-12-29 21:02:56 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2022-04-18 14:48:36 +00:00
|
|
|
go-version: [1.16.x]
|
|
|
|
os: [ubuntu-latest]
|
2021-12-29 21:02:56 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- name: Create GOPATH
|
|
|
|
run: mkdir -p /tmp/go
|
|
|
|
- name: Install Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: ${{ matrix.go-version }}
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Run database
|
|
|
|
run: docker-compose -f docker-compose.test.yml -f docker-compose.yml up -d ipld-eth-db dapptools contract eth-server
|
|
|
|
- name: Test
|
|
|
|
run: |
|
|
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8081)" != "200" ]; do echo "waiting for ipld-eth-server..." && sleep 5; done && \
|
|
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \
|
|
|
|
make integrationtest
|