Skip to content

Always send in system-tests (#102) #339

Always send in system-tests (#102)

Always send in system-tests (#102) #339

Workflow file for this run

name: Dockerfile
on:
push:
branches:
- master
tags:
- '*'
pull_request:
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }}
cancel-in-progress: true
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
# the only time system test image needs to be defined for a push is when it's a non 'v' tag creation
PUSH_ENABLED: ${{ secrets.DOCKERHUB_TOKEN && github.ref_type == 'tag' && startsWith(github.ref_name, 'v') != true && 'true' || 'false' }}
IMAGE: ${{ format('{0}/{1}:{2}', secrets.DOCKERHUB_TOKEN && 'docker.io' || 'ghcr.io', github.repository, github.ref_type == 'tag' && github.ref_name || github.event.ref || 'latest') }}
CORE_GIT_REF: https://github.com/stellar/stellar-core.git#master
SOROBAN_RPC_GIT_REF: https://github.com/stellar/soroban-rpc.git#main
RUST_TOOLCHAIN_VERSION: stable
SOROBAN_CLI_GIT_REF: https://github.com/stellar/soroban-tools.git#main
QUICKSTART_GIT_REF: https://github.com/stellar/quickstart.git#master
# leaving sdk npm version blank defaults to whatever npm has for latest version
# rather than build from git source, which is fine for ci test build
JS_STELLAR_SDK_NPM_VERSION:
RS_XDR_GIT_REPO: https://github.com/stellar/rs-stellar-xdr
RS_XDR_GIT_REF: main
jobs:
complete:
if: always()
needs: [build]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
build:
runs-on: ubuntu-latest-16-cores
outputs:
push_enabled: ${{ env.PUSH_ENABLED }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.HEAD_SHA }}
- name: Build System Test Image
run: |
make CORE_GIT_REF=${{ env.CORE_GIT_REF }} \
CORE_COMPILE_CONFIGURE_FLAGS="${{ env.CORE_COMPILE_CONFIGURE_FLAGS }}" \
SOROBAN_RPC_GIT_REF=${{ env.SOROBAN_RPC_GIT_REF }} \
RUST_TOOLCHAIN_VERSION=${{ env.RUST_TOOLCHAIN_VERSION }} \
SOROBAN_CLI_GIT_REF=${{ env.SOROBAN_CLI_GIT_REF }} \
SYSTEM_TEST_IMAGE=${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} \
JS_STELLAR_SDK_NPM_VERSION=${{ env.JS_STELLAR_SDK_NPM_VERSION }} \
RS_XDR_GIT_REPO=${{ env.RS_XDR_GIT_REPO }} \
RS_XDR_GIT_REF=${{ env.RS_XDR_GIT_REF }} \
QUICKSTART_GIT_REF=${{ env.QUICKSTART_GIT_REF }} build;
- if: ${{ env.PUSH_ENABLED == 'true' }}
name: Save Docker Image to file
run: |
docker save ${{ env.IMAGE }} -o /tmp/image;
- if: ${{ env.PUSH_ENABLED == 'true' }}
name: Upload System Test Image
uses: actions/upload-artifact@v2
with:
name: image-Dockerfile
path: /tmp/image
push:
# Only push non 'vX.Y.Z' tags as pre-built system test image with versions compiled into image.
# pr's and releases don't need to be pushed as docker images, because system test is meant to be built
# from source locally.
needs: build
permissions:
packages: write
statuses: write
runs-on: ubuntu-latest
if: needs.build.outputs.push_enabled == 'true'
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.HEAD_SHA }}
- id: push
uses: ./.github/actions/push
with:
head_sha: ${{ env.HEAD_SHA }}
artifact_name: image-Dockerfile
artifact_image_file: image
image: ${{ env.IMAGE }}
registry: ${{ secrets.DOCKERHUB_TOKEN && 'docker.io' || 'ghcr.io' }}
username: ${{ secrets.DOCKERHUB_USERNAME || github.actor }}
password: ${{ secrets.DOCKERHUB_TOKEN || github.token }}