Update license #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: e2e | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
env: | |
KUBECONFIG: k3s.yaml | |
jobs: | |
test: | |
name: test | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 2 | |
matrix: | |
target: [ci_all] | |
steps: | |
- name: Set up go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.15' | |
- name: checkout code | |
uses: actions/checkout@master | |
- name: build mainnet-observer image | |
run: docker build -t localhost/mainnet-observer:local . | |
- name: spin up k3s | |
uses: insolar/[email protected] | |
with: | |
kubectl_version: "v1.18.2" | |
k3s_tag: "v1.17.4-k3s1" | |
custom_registry: true | |
registries_yaml_path: "deploy/registries.yaml" | |
- name: set PAT for github http auth | |
run: | | |
git config --global url."https://${{secrets.INS_SERVICE_PAT}}@github.com/".insteadOf "https://github.com/" | |
kubectl create ns insolar && kubectl -n insolar create secret generic ins-service-pat --from-literal=INS_SERVICE_PAT=${{secrets.INS_SERVICE_PAT}} | |
- name: set up local registry | |
run: kubectl apply -k https://github.com/insolar/gitops/k3s-registry | |
- name: wait for registry to be up and running | |
run: kubectl -n registry rollout status deploy/registry --timeout=80s | |
- name: push mainnet-observer image to local registry | |
run: docker push localhost/mainnet-observer:local | |
- name: deploy insolar-mainnet | |
run: kubectl apply -k deploy/mainnet | |
- name: wait for bootstrap completion | |
run: | | |
echo "waiting for bootstrap completion…" | |
for attempt in {1..120}; do | |
STATUS=$(kubectl -n insolar get po bootstrap -o jsonpath='{.status.phase}') | |
[[ "${STATUS}" == "Succeeded" ]] && exit 0 || sleep 1 | |
done | |
exit 1 | |
- name: wait for insolar network initialization | |
run: | | |
echo "waiting for insolar network initialization…" | |
for try in {0..180}; do | |
if kubectl -n insolar exec -i deploy/pulsewatcher -- bash -c 'pulsewatcher -c /etc/pulsewatcher/pulsewatcher.yaml -s' | grep 'READY' | grep -v 'NOT'; then | |
exit 0 | |
else | |
sleep 1 | |
fi | |
done | |
exit 1 | |
- name: wait for observer-replicator pod to be up and running | |
run: kubectl -n insolar rollout status sts/observer-replicator -w --timeout=60s | |
- name: spawn autotests pod | |
run: | | |
# create secret | |
kubectl -n insolar create secret docker-registry ins-registry \ | |
--docker-server=${{ secrets.REGISTRY_URL }} \ | |
--docker-username=${{ secrets.REGISTRY_USERNAME }} \ | |
--docker-password=${{ secrets.REGISTRY_PASSWORD }} | |
# patch sa | |
kubectl -n insolar patch sa default -p '{"imagePullSecrets":[{"name":"ins-registry"}]}' | |
kubectl -n insolar apply -k deploy/autotests-pod | |
- name: wait for pod initialization | |
run: | | |
for attempt in {1..10}; do | |
STATUS=$(kubectl -n insolar get po go-autotests -o jsonpath='{.status.phase}') | |
[[ "${STATUS}" == "Running" ]] && exit 0 || sleep $attempt | |
done | |
- name: run autotests | |
run: | | |
kubectl -n insolar get po | |
kubectl -n insolar exec go-autotests -- /bin/sh -c 'git config --global url."https://${INS_SERVICE_PAT}@github.com".insteadOf "https://github.com"' | |
kubectl -n insolar exec go-autotests -- make ${{matrix.target}} > logs.log | |
- name: display logs | |
if: always() | |
run: cat logs.log | |
- name: Download go-test-parser | |
if: failure() | |
run: | | |
mkdir -p $GITHUB_WORKSPACE/bin | |
curl -L -s "https://github.com/Tsovak/go-test-parser/releases/download/v1.0.2/go-test-parser_v1.0.2_Linux_x86_64.tar.gz" -o go-test-parser.tar.gz | |
tar -xf go-test-parser.tar.gz -C $GITHUB_WORKSPACE/bin/ | |
chmod +x bin/go-test-parser | |
echo "::add-path::$GITHUB_WORKSPACE/bin" | |
- name: Create tests report | |
if: failure() | |
run: | | |
go-test-parser logs.log -o report | |
- name: Upload report to artifacts | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{matrix.target}} | |
path: "report" |