remove outdated custom runner; simplify unit tests action
This commit is contained in:
parent
f689e60292
commit
97a4cbddc8
4
.github/workflows/on-pr-publish.yaml
vendored
4
.github/workflows/on-pr-publish.yaml
vendored
@ -23,10 +23,6 @@ jobs:
|
|||||||
uses: ./.github/workflows/tests.yaml
|
uses: ./.github/workflows/tests.yaml
|
||||||
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
|
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
|
||||||
needs: pre_job
|
needs: pre_job
|
||||||
secrets:
|
|
||||||
BUILD_HOSTNAME: ${{ secrets.BUILD_HOSTNAME }}
|
|
||||||
BUILD_USERNAME: ${{ secrets.BUILD_USERNAME }}
|
|
||||||
BUILD_KEY: ${{ secrets.BUILD_KEY }}
|
|
||||||
with:
|
with:
|
||||||
STACK_ORCHESTRATOR_REF: "f2fd766f5400fcb9eb47b50675d2e3b1f2753702"
|
STACK_ORCHESTRATOR_REF: "f2fd766f5400fcb9eb47b50675d2e3b1f2753702"
|
||||||
GO_ETHEREUM_REF: "c339429ff6550d8012d65977fc79f73bba2616e3"
|
GO_ETHEREUM_REF: "c339429ff6550d8012d65977fc79f73bba2616e3"
|
||||||
|
31
.github/workflows/run_unit_test.sh
vendored
31
.github/workflows/run_unit_test.sh
vendored
@ -1,31 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
# Set up repo
|
|
||||||
start_dir=$(pwd)
|
|
||||||
temp_dir=$(mktemp -d)
|
|
||||||
cd $temp_dir
|
|
||||||
|
|
||||||
git clone -b $(cat /tmp/git_head_ref) "https://github.com/$(cat /tmp/git_repository).git"
|
|
||||||
cd ipld-eth-server
|
|
||||||
|
|
||||||
## Remove the branch and github related info. This way future runs wont be confused.
|
|
||||||
rm -f /tmp/git_head_ref /tmp/git_repository
|
|
||||||
|
|
||||||
# Spin up DB and run migrations
|
|
||||||
echo 'docker-compose up -d migrations ipld-eth-db'
|
|
||||||
docker-compose up -d migrations ipld-eth-db
|
|
||||||
trap "docker-compose down -v --remove-orphans; cd $start_dir ; rm -r $temp_dir" SIGINT SIGTERM ERR
|
|
||||||
sleep 60
|
|
||||||
|
|
||||||
# Remove old logs so there's no confusion, then run test
|
|
||||||
rm -f /tmp/test.log /tmp/return_test.txt
|
|
||||||
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=localhost DATABASE_NAME=vulcanize_testing make test | tee /tmp/test.log
|
|
||||||
echo $? > /tmp/return_test.txt
|
|
||||||
|
|
||||||
# Clean up
|
|
||||||
docker-compose down -v --remove-orphans
|
|
||||||
cd $start_dir
|
|
||||||
rm -fr $temp_dir
|
|
47
.github/workflows/tests.yaml
vendored
47
.github/workflows/tests.yaml
vendored
@ -1,13 +1,6 @@
|
|||||||
name: Test the stack.
|
name: Test the stack.
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
secrets:
|
|
||||||
BUILD_HOSTNAME:
|
|
||||||
required: true
|
|
||||||
BUILD_USERNAME:
|
|
||||||
required: true
|
|
||||||
BUILD_KEY:
|
|
||||||
required: true
|
|
||||||
inputs:
|
inputs:
|
||||||
STACK_ORCHESTRATOR_REF:
|
STACK_ORCHESTRATOR_REF:
|
||||||
required: true
|
required: true
|
||||||
@ -31,10 +24,6 @@ jobs:
|
|||||||
name: Run unit tests
|
name: Run unit tests
|
||||||
env:
|
env:
|
||||||
GOPATH: /tmp/go
|
GOPATH: /tmp/go
|
||||||
# To run the unit tests you need to add secrets to your repository.
|
|
||||||
BUILD_HOSTNAME: ${{ secrets.BUILD_HOSTNAME }}
|
|
||||||
BUILD_USERNAME: ${{ secrets.BUILD_USERNAME }}
|
|
||||||
BUILD_KEY: ${{ secrets.BUILD_KEY }}
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@ -45,38 +34,18 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: 1.19.7
|
go-version: 1.19.7
|
||||||
|
|
||||||
# Passed experience with GHA has taught me to store variables in files instead of passing them as variables.
|
- name: Bring up docker timescaledb container
|
||||||
- name: Output variables to files
|
run: docker compose up -d ipld-eth-db
|
||||||
run: |
|
|
||||||
echo $GITHUB_REPOSITORY > /tmp/git_repository
|
|
||||||
[ -z "$GITHUB_HEAD_REF" ] && echo $GITHUB_REF_NAME > /tmp/git_head_ref || echo $GITHUB_HEAD_REF > /tmp/git_head_ref
|
|
||||||
echo "-----BEGIN OPENSSH PRIVATE KEY-----" >> /tmp/key
|
|
||||||
echo ${{ env.BUILD_KEY }} >> /tmp/key
|
|
||||||
echo "-----END OPENSSH PRIVATE KEY-----" >> /tmp/key
|
|
||||||
chmod 400 /tmp/key
|
|
||||||
cat /tmp/git_repository
|
|
||||||
cat /tmp/git_head_ref
|
|
||||||
|
|
||||||
- name: Raw SCP
|
- name: Run db migrations
|
||||||
run: |
|
run: |
|
||||||
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/git_repository ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_repository
|
sleep 30;
|
||||||
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/git_head_ref ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_head_ref
|
docker compose up -d migrations
|
||||||
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key .github/workflows/run_unit_test.sh ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/run_unit_test.sh
|
|
||||||
|
|
||||||
- name: Trigger Unit Test
|
- name: Run test
|
||||||
run: |
|
run: |
|
||||||
ssh -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }} go install github.com/onsi/ginkgo/ginkgo@latest
|
sleep 30;
|
||||||
ssh -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }} /tmp/run_unit_test.sh
|
PGPASSWORD=password DATABASE_USER=vdbm DATABASE_PORT=8077 DATABASE_PASSWORD=password DATABASE_HOSTNAME=127.0.0.1 DATABASE_NAME=vulcanize_testing make test
|
||||||
|
|
||||||
- name: Get the logs and cat them
|
|
||||||
run: |
|
|
||||||
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/test.log .
|
|
||||||
cat ./test.log
|
|
||||||
|
|
||||||
- name: Check Error Code
|
|
||||||
run: |
|
|
||||||
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/return_test.txt .
|
|
||||||
[ $(cat ./return_test.txt) -eq 0 ]
|
|
||||||
|
|
||||||
integrationtest:
|
integrationtest:
|
||||||
name: Run integration tests
|
name: Run integration tests
|
||||||
|
Loading…
Reference in New Issue
Block a user