Commit 2e2960bc authored by Ivan Vandot's avatar Ivan Vandot Committed by GitHub

tidy up workflows and set repository-dispatch (#608)

parent 370a0e97
name: BeekeeperDNSDisco
on:
push:
branches:
- master
jobs:
beekeeper:
env:
REPLICA: 3
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install bee-local
run: |
export URL=$(curl -s https://api.github.com/repos/ethersphere/bee-local/releases/latest | jq -r .tarball_url)
curl -Ls ${URL} -o bee-local.tar.gz
tar --strip-components=1 --wildcards -xzf bee-local.tar.gz ethersphere-bee-local-*/{beeinfra.sh,helm-values,hack}
- name: Install latest beekeeper
run: |
export TAG=$(curl -s https://api.github.com/repos/ethersphere/beekeeper/releases/latest | jq -r .tag_name)
curl -Ls https://github.com/ethersphere/beekeeper/releases/download/${TAG}/beekeeper-linux-amd64 -o beekeeper
chmod +x beekeeper
- name: Add entries to /etc/hosts
run: |
echo -e "127.0.0.10\tregistry.localhost" | sudo tee -a /etc/hosts
for ((i=0; i<REPLICA; i++)); do echo -e "127.0.1.$((i+1))\tbee-${i}.localhost bee-${i}-debug.localhost"; done | sudo tee -a /etc/hosts
- name: Set testing cluster
run: ./beeinfra.sh install --dns-disco --local -r "${REPLICA}" --bootnode /dnsaddr/localhost
- name: Test fullconnectivity
run: ./beekeeper check fullconnectivity --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Test pingpong
run: ./beekeeper check pingpong --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Test pushsync (bytes)
run: ./beekeeper check pushsync --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3
- name: Test pushsync (chunks)
run: ./beekeeper check pushsync --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3 --upload-chunks
- name: Test retrieval
run: ./beekeeper check retrieval --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3
name: BeekeeperLocalPinning
on:
push:
branches:
- master
jobs:
beekeeper:
env:
REPLICA: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install k3d
run: curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=v1.7.0 bash
- name: Install latest beekeeper
run: |
export TAG=$(curl -s https://api.github.com/repos/ethersphere/beekeeper/releases/latest | jq -r .tag_name)
curl -Ls https://github.com/ethersphere/beekeeper/releases/download/${TAG}/beekeeper-linux-amd64 -o beekeeper
chmod +x beekeeper
- name: Create cluster
run: k3d create --publish="80:80" --enable-registry --registry-name registry.localhost
- name: Set kubeconfig
run: |
until k3d get-kubeconfig --name='k3s-default' &> /dev/null; do echo "Waiting for the cluster..."; sleep 1; done
mkdir ~/.kube
cp $(k3d get-kubeconfig --name='k3s-default') ~/.kube/config
- name: Add entries to /etc/hosts
run: |
echo -e "127.0.0.10\tregistry.localhost" | sudo tee -a /etc/hosts
for ((i=0; i<REPLICA; i++)); do echo -e "127.0.1.$((i+1))\tbee-${i}.localhost bee-${i}-debug.localhost"; done | sudo tee -a /etc/hosts
- name: Set helm repo and namespace
run: |
helm repo add ethersphere "https://ethersphere.github.io/helm"
kubectl create ns bee
- name: Build latest bee image
run: |
docker build --network=host -t registry.localhost:5000/ethersphere/bee:latest .
docker push registry.localhost:5000/ethersphere/bee:latest
- name: Set bees
run: |
export LAST_BEE=$(($REPLICA-1))
until kubectl get svc traefik -n kube-system &> /dev/null; do echo "Waiting for the traefik service..."; sleep 1; done
helm install bee -f .github/beekeeper/bee.yaml ethersphere/bee --namespace bee --set image.repository=registry.localhost:5000/ethersphere/bee --set replicaCount="${REPLICA}" --set libp2pSettings.enabled=true --set beeConfig.db_capacity=500 --wait
until [[ "$(curl -s bee-${LAST_BEE}-debug.localhost/readiness | jq -r .status)" == "ok" ]] &> /dev/null; do echo "Waiting for the last bee..."; sleep 1; done
- name: Test localpinning 1
run: ./beekeeper check localpinning --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Test localpinning 2
run: ./beekeeper check localpinning --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --large-file-disk-ratio 2
- name: Test localpinning 3
run: ./beekeeper check localpinning --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --large-file-disk-ratio 2 --large-file-count 10
name: Beekeeper name: Beekeeper
on: on:
push: repository_dispatch:
branches: types: [trigger-beekeeper]
- master
jobs: jobs:
beekeeper: beekeeper:
...@@ -11,39 +10,35 @@ jobs: ...@@ -11,39 +10,35 @@ jobs:
REPLICA: 3 REPLICA: 3
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v1 - name: Checkout
- name: Install k3d uses: actions/checkout@v2
run: curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=v1.7.0 bash with:
fetch-depth: 1
- name: Install bee-local
run: |
export URL=$(curl -s https://api.github.com/repos/ethersphere/bee-local/releases/latest | jq -r .tarball_url)
curl -Ls ${URL} -o bee-local.tar.gz
tar --strip-components=1 --wildcards -xzf bee-local.tar.gz ethersphere-bee-local-*/{beeinfra.sh,helm-values,hack}
- name: Install latest beekeeper - name: Install latest beekeeper
run: | run: |
export TAG=$(curl -s https://api.github.com/repos/ethersphere/beekeeper/releases/latest | jq -r .tag_name) export TAG=$(curl -s https://api.github.com/repos/ethersphere/beekeeper/releases/latest | jq -r .tag_name)
curl -Ls https://github.com/ethersphere/beekeeper/releases/download/${TAG}/beekeeper-linux-amd64 -o beekeeper curl -Ls https://github.com/ethersphere/beekeeper/releases/download/${TAG}/beekeeper-linux-amd64 -o beekeeper
chmod +x beekeeper chmod +x beekeeper
- name: Create cluster - name: Set testing cluster (DNS discovery)
run: k3d create --publish="80:80" --enable-registry --registry-name registry.localhost run: ./beeinfra.sh install --dns-disco --local -r "${REPLICA}" --bootnode /dnsaddr/localhost
- name: Set kubeconfig
run: |
until k3d get-kubeconfig --name='k3s-default' &> /dev/null; do echo "Waiting for the cluster..."; sleep 1; done
mkdir ~/.kube
cp $(k3d get-kubeconfig --name='k3s-default') ~/.kube/config
- name: Add entries to /etc/hosts - name: Add entries to /etc/hosts
run: | run: |
echo -e "127.0.0.10\tregistry.localhost" | sudo tee -a /etc/hosts echo -e "127.0.0.10\tregistry.localhost" | sudo tee -a /etc/hosts
for ((i=0; i<REPLICA; i++)); do echo -e "127.0.1.$((i+1))\tbee-${i}.localhost bee-${i}-debug.localhost"; done | sudo tee -a /etc/hosts for ((i=0; i<REPLICA; i++)); do echo -e "127.0.1.$((i+1))\tbee-${i}.localhost bee-${i}-debug.localhost"; done | sudo tee -a /etc/hosts
- name: Set helm repo and namespace - name: Test fullconnectivity
run: | run: ./beekeeper check fullconnectivity --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
helm repo add ethersphere "https://ethersphere.github.io/helm" - name: Test pingpong
kubectl create ns bee run: ./beekeeper check pingpong --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Build latest bee image - name: Clean the cluster
run: |
docker build --network=host -t registry.localhost:5000/ethersphere/bee:latest .
docker push registry.localhost:5000/ethersphere/bee:latest
- name: Set bees
run: | run: |
export LAST_BEE=$(($REPLICA-1)) ./beeinfra.sh uninstall -r "${REPLICA}"
until kubectl get svc traefik -n kube-system &> /dev/null; do echo "Waiting for the traefik service..."; sleep 1; done - name: Set testing cluster (Node connection)
helm install bee -f .github/beekeeper/bee.yaml ethersphere/bee --namespace bee --set image.repository=registry.localhost:5000/ethersphere/bee --set replicaCount="${REPLICA}" --set libp2pSettings.enabled=true --wait run: ./beeinfra.sh install --local -r "${REPLICA}"
until [[ "$(curl -s bee-${LAST_BEE}-debug.localhost/readiness | jq -r .status)" == "ok" ]] &> /dev/null; do echo "Waiting for the last bee..."; sleep 1; done
- name: Test fullconnectivity - name: Test fullconnectivity
run: ./beekeeper check fullconnectivity --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" run: ./beekeeper check fullconnectivity --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Test pingpong - name: Test pingpong
...@@ -56,8 +51,27 @@ jobs: ...@@ -56,8 +51,27 @@ jobs:
run: ./beekeeper check retrieval --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3 run: ./beekeeper check retrieval --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3
- name: Test pullsync - name: Test pullsync
run: ./beekeeper check pullsync --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3 run: ./beekeeper check pullsync --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --upload-node-count "${REPLICA}" --chunks-per-node 3
- name: Retag docker image and push - name: Clean the cluster
run: |
./beeinfra.sh uninstall -r "${REPLICA}"
grep -vE 'bee|registry.localhost' /etc/hosts | sudo tee /etc/hosts
- name: Set testing cluster (Node connection) 5 bee nodes
run: |
echo "::set-env name=REPLICA::5"
./beeinfra.sh install --local -r "${REPLICA}"
- name: Add entries to /etc/hosts
run: |
echo -e "127.0.0.10\tregistry.localhost" | sudo tee -a /etc/hosts
for ((i=0; i<REPLICA; i++)); do echo -e "127.0.1.$((i+1))\tbee-${i}.localhost bee-${i}-debug.localhost"; done | sudo tee -a /etc/hosts
- name: Test localpinning 1
run: ./beekeeper check localpinning --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}"
- name: Test localpinning 2
run: ./beekeeper check localpinning --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --large-file-disk-ratio 2
- name: Test localpinning 3
run: ./beekeeper check localpinning --api-scheme http --debug-api-scheme http --disable-namespace --debug-api-domain localhost --api-domain localhost --node-count "${REPLICA}" --large-file-disk-ratio 2 --large-file-count 10
- name: Retag Docker image and push
if: success()
run: | run: |
docker tag registry.localhost:5000/ethersphere/bee:latest ethersphere/bee:latest docker tag registry.localhost:5000/ethersphere/bee:latest ethersphere/bee:latest
printf ${{ secrets.DOCKERHUB_PASSWORD }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin printf ${{ secrets.DOCKERHUB_PASSWORD }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
docker push ethersphere/bee:latest docker push ethersphere/bee:latest
\ No newline at end of file
name: Coverage
on:
push:
branches:
- 'master'
pull_request:
branches:
- '**'
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.15
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Report results to DeepSource
run: |
go test -coverprofile=cover.out ./...
curl https://deepsource.io/cli | sh
./bin/deepsource report --analyzer test-coverage --key go --value-file ./cover.out
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
\ No newline at end of file
...@@ -43,14 +43,14 @@ jobs: ...@@ -43,14 +43,14 @@ jobs:
${{ runner.OS }}-build-${{ env.cache-name }}- ${{ runner.OS }}-build-${{ env.cache-name }}-
${{ runner.OS }}-build- ${{ runner.OS }}-build-
${{ runner.OS }}- ${{ runner.OS }}-
- name: Build
run: make build
- name: Lint - name: Lint
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: make lint run: make lint
- name: Vet - name: Vet
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: make vet run: make vet
- name: Build
run: make build
- name: Test with Race Detector - name: Test with Race Detector
# do not tests with race detector on windows # do not tests with race detector on windows
# until the issue with badgerdb memory allocation # until the issue with badgerdb memory allocation
...@@ -60,3 +60,19 @@ jobs: ...@@ -60,3 +60,19 @@ jobs:
- name: Test - name: Test
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
run: make test run: make test
- name: DeepSource Coverage
if: matrix.os == 'ubuntu-latest'
run: |
go test -coverprofile=cover.out ./...
curl https://deepsource.io/cli | sh
./bin/deepsource report --analyzer test-coverage --key go --value-file ./cover.out
env:
DEEPSOURCE_DSN: ${{ secrets.DEEPSOURCE_DSN }}
- name: Trigger Beekeeper
if: success() && ${{ github.ref }} == "refs/heads/master"
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.REPO_GHA_PAT }}
repository: ${{ github.repository }}
event-type: trigger-beekeeper
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment