integrate with repo snapshots #120
Workflow file for this run
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: Dockerize | |
concurrency: | |
group: "publish-${{ github.ref }}" | |
cancel-in-progress: true | |
on: | |
pull_request: | |
push: | |
branches: [ master, staging, sprint* ] | |
workflow_dispatch: | |
env: | |
DNS_REGISTRY: ${{ secrets.DNS_REGISTRY }} | |
jobs: | |
zdns: | |
name: "0dns" | |
runs-on: [self-hosted, arc-runner] | |
steps: | |
- name: Set docker image tag | |
id: get_info | |
run: | | |
if [[ "${{github.ref}}" == refs/pull/* ]]; then | |
tag=${GITHUB_REF/\/merge/} | |
echo "TAG=$(echo pr-${tag:10})" >> $GITHUB_ENV | |
else | |
echo "TAG=$(echo ${GITHUB_REF#refs/*/} | sed 's/\//-/g')" >> $GITHUB_ENV | |
fi | |
echo "BRANCH=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo ${GITHUB_REF#refs/*/} || echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV | |
echo "SHA=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo $GITHUB_SHA || echo '${{ github.event.pull_request.head.sha }}')" >> $GITHUB_ENV | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
run: | | |
sudo apt-get update | |
sudo apt-get install ca-certificates curl gnupg lsb-release -y | |
sudo mkdir -m 0755 -p /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update | |
sudo apt-get install docker-ce docker-ce-cli containerd.io -y | |
export DOCKER_CLI_EXPERIMENTAL=enabled | |
docker run --privileged --rm tonistiigi/binfmt --install all | |
docker context create dns_buildx | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build & Publish 0dns Docker Image | |
run: | | |
SHORT_SHA=$(echo ${{ env.SHA }} | head -c 8) | |
docker buildx create --driver-opt network=host --use --buildkitd-flags '--allow-insecure-entitlement security.insecure' --use dns_buildx | |
docker buildx build --platform linux/amd64,linux/arm64 --push -t $DNS_REGISTRY:$TAG -t $DNS_REGISTRY:$TAG-$SHORT_SHA -f "$DOCKERFILE_DNS" . | |
env: | |
DOCKERFILE_DNS: "docker.local/Dockerfile" | |
- name: Push latest | |
if: ${{ github.ref == 'refs/heads/master' }} | |
run: docker push $DNS_REGISTRY:latest | |
system-tests: | |
if: github.event_name != 'workflow_dispatch' | |
needs: zdns | |
runs-on: [ tests-suite ] | |
steps: | |
- name: "Get current PR" | |
uses: jwalton/gh-find-current-pr@v1 | |
id: findPr | |
with: | |
github-token: ${{ github.token }} | |
- name: "Set PR status as pending" | |
uses: niteoweb/pull_request_status_action@v1.0.0 | |
if: steps.findPr.outputs.number | |
with: | |
pr_number: ${{ steps.findPr.outputs.pr }} | |
description: "System tests running with default config..." | |
state: "pending" | |
repository: ${{ github.repository }} | |
context: "0Chain System Tests" | |
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: "Setup" | |
run: | | |
if [[ "${{github.ref}}" == refs/pull/* ]]; then | |
tag=${GITHUB_REF/\/merge/} | |
echo "TAG=$(echo pr-${tag:10})" >> $GITHUB_ENV | |
else | |
echo "TAG=$(echo ${GITHUB_REF#refs/*/} | sed 's/\//-/g')" >> $GITHUB_ENV | |
fi | |
echo "BRANCH=$([ -z '${{ github.event.pull_request.head.sha }}' ] && echo ${GITHUB_REF#refs/*/} || echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV | |
echo "SHORT_SHA=$(([ -z '${{ github.event.pull_request.head.sha }}' ] && echo $GITHUB_SHA || echo '${{ github.event.pull_request.head.sha }}') | head -c 8)" >> $GITHUB_ENV | |
echo "NETWORK_URL=$(echo dev-${RUNNER_NAME:(-1)}.devnet-0chain.net)" >> $GITHUB_ENV | |
echo "RUNNER_NUMBER=${RUNNER_NAME:(-1)}" >> $GITHUB_ENV | |
- name: "Deploy 0Chain" | |
uses: 0chain/actions/deploy-0chain@master | |
with: | |
zdns_image: ${{ env.TAG }}-${{ env.SHORT_SHA }} | |
repo_snapshots_branch: "<CURRENT BRANCH WITH FALLBACK TO CURRENT_SPRINT>" | |
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} | |
kube_config: ${{ secrets[format('DEV{0}KC', env.RUNNER_NUMBER)] }} | |
teardown_condition: "TESTS_PASSED" | |
SUBGRAPH_API_URL: ${{ secrets.SUBGRAPH_API_URL }} | |
TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }} | |
graphnode_sc: ${{ secrets.GRAPHNODE_SC }} | |
graphnode_network: ${{ secrets.GRAPHNODE_NETWORK }} | |
graphnode_ethereum_node_url: https://rpc.tenderly.co/fork/${{ secrets.TENDERLY_FORK_ID }} | |
- name: "Run System tests" | |
uses: 0chain/actions/run-system-tests@master | |
with: | |
repo_snapshots_branch: "<CURRENT BRANCH WITH FALLBACK TO CURRENT_SPRINT>" | |
network: ${{ env.NETWORK_URL }} | |
svc_account_secret: ${{ secrets.SVC_ACCOUNT_SECRET }} | |
deploy_report_page: false | |
archive_results: true | |
run_flaky_tests: false | |
run_smoke_tests: ${{ github.ref != 'refs/heads/staging' && github.base_ref != 'staging' && github.ref != 'refs/heads/master' && github.base_ref != 'master' }} | |
retry_failures: true | |
TENDERLY_FORK_ID: ${{ secrets.TENDERLY_FORK_ID }} | |
DEVOPS_CHANNEL_WEBHOOK_URL: ${{ secrets.DEVOPS_CHANNEL_WEBHOOK_URL }} | |
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} | |
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} | |
- name: "Set PR status as ${{ job.status }}" | |
if: ${{ (success() || failure()) && steps.findPr.outputs.number }} | |
uses: niteoweb/pull_request_status_action@v1.0.0 | |
with: | |
pr_number: ${{ steps.findPr.outputs.pr }} | |
description: "System tests with default config" | |
state: ${{ job.status }} | |
repository: ${{ github.repository }} | |
context: "0Chain System Tests" | |
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |