Merge pull request #52 from eosnetworkfoundation/elmato/merge-kayan_0… #134
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: "Build & Test" | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
override-cdt: | |
description: 'Override cdt target' | |
type: string | |
override-cdt-prerelease: | |
type: choice | |
description: Override cdt prelease | |
options: | |
- default | |
- true | |
- false | |
override-eos-evm-contract: | |
description: 'Override eos-evm-contract target' | |
type: string | |
override-eos-evm-contract-prerelease: | |
type: choice | |
description: Override eos-evm-contract prelease | |
options: | |
- default | |
- true | |
- false | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
d: | |
name: Discover Platforms | |
runs-on: ubuntu-latest | |
outputs: | |
missing-platforms: ${{steps.discover.outputs.missing-platforms}} | |
p: ${{steps.discover.outputs.platforms}} | |
steps: | |
- name: Discover Platforms | |
id: discover | |
uses: AntelopeIO/discover-platforms-action@v1 | |
with: | |
platform-file: .cicd/platforms.json | |
password: ${{secrets.GITHUB_TOKEN}} | |
package-name: bridge-contract-builders | |
build-platforms: | |
name: Build Platforms | |
needs: d | |
if: needs.d.outputs.missing-platforms != '[]' | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: ${{fromJSON(needs.d.outputs.missing-platforms)}} | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Login to Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{github.repository_owner}} | |
password: ${{secrets.GITHUB_TOKEN}} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
tags: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}} | |
file: ${{fromJSON(needs.d.outputs.p)[matrix.platform].dockerfile}} | |
versions: | |
name: Determine Versions | |
runs-on: ubuntu-latest | |
outputs: | |
antelope-spring-dev-target: ${{steps.versions.outputs.antelope-spring-dev-target}} | |
antelope-spring-dev-prerelease: ${{steps.versions.outputs.antelope-spring-dev-prerelease}} | |
cdt-target: ${{steps.versions.outputs.cdt-target}} | |
cdt-prerelease: ${{steps.versions.outputs.cdt-prerelease}} | |
eos-evm-contract-target: ${{steps.versions.outputs.eos-evm-contract-target}} | |
eos-evm-contract-prerelease: ${{steps.versions.outputs.eos-evm-contract-prerelease}} | |
steps: | |
- name: Setup versions from input or defaults | |
id: versions | |
env: | |
GH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
run: | | |
DEFAULTS_JSON=$(curl -sSfL $(gh api https://api.github.com/repos/${{github.repository}}/contents/.cicd/defaults.json?ref=${{github.sha}} --jq .download_url)) | |
echo antelope-spring-dev-target=$(echo "$DEFAULTS_JSON" | jq -r '."antelope-spring-dev".target') >> $GITHUB_OUTPUT | |
echo antelope-spring-dev-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."antelope-spring-dev".prerelease') >> $GITHUB_OUTPUT | |
echo cdt-target=$(echo "$DEFAULTS_JSON" | jq -r '."cdt".target') >> $GITHUB_OUTPUT | |
echo cdt-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."cdt".prerelease') >> $GITHUB_OUTPUT | |
echo eos-evm-contract-target=$(echo "$DEFAULTS_JSON" | jq -r '."eos-evm-contract".target') >> $GITHUB_OUTPUT | |
echo eos-evm-contract-prerelease=$(echo "$DEFAULTS_JSON" | jq -r '."eos-evm-contract".prerelease') >> $GITHUB_OUTPUT | |
if [[ "${{inputs.override-cdt}}" != "" ]]; then | |
echo cdt-target=${{inputs.override-cdt}} >> $GITHUB_OUTPUT | |
fi | |
if [[ "${{inputs.override-cdt-prerelease}}" == +(true|false) ]]; then | |
echo cdt-prerelease=${{inputs.override-cdt-prerelease}} >> $GITHUB_OUTPUT | |
fi | |
if [[ "${{inputs.override-eos-evm-contract}}" != "" ]]; then | |
echo eos-evm-contract-target=${{inputs.override-eos-evm-contract}} >> $GITHUB_OUTPUT | |
fi | |
if [[ "${{inputs.override-eos-evm-contract-prerelease}}" == +(true|false) ]]; then | |
echo eos-evm-contract-prerelease=${{inputs.override-eos-evm-contract-prerelease}} >> $GITHUB_OUTPUT | |
fi | |
build: | |
name: EOS EVM Bridge Contracts Build & Test | |
needs: [d, build-platforms, versions] | |
if: always() && needs.d.result == 'success' && (needs.build-platforms.result == 'success' || needs.build-platforms.result == 'skipped') && needs.versions.result == 'success' | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [ ubuntu22 ] | |
runs-on: ubuntu-latest | |
container: ${{fromJSON(needs.d.outputs.p)[matrix.platform].image}} | |
steps: | |
- name: Checkout evm-bridge-contracts | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
path: evm-bridge-contracts | |
- name: Download CDT | |
uses: AntelopeIO/asset-artifact-download-action@v3 | |
with: | |
owner: AntelopeIO | |
repo: cdt | |
target: '${{needs.versions.outputs.cdt-target}}' | |
prereleases: ${{fromJSON(needs.versions.outputs.cdt-prerelease)}} | |
file: 'cdt_.*amd64.deb' | |
- name: Download antelope-spring-dev | |
uses: AntelopeIO/asset-artifact-download-action@v3 | |
with: | |
owner: AntelopeIO | |
repo: spring | |
file: 'antelope-spring-dev.*ubuntu22\.04_amd64.deb' | |
target: '${{needs.versions.outputs.antelope-spring-dev-target}}' | |
prereleases: ${{fromJSON(needs.versions.outputs.antelope-spring-dev-prerelease)}} | |
artifact-name: antelope-spring-dev-ubuntu22-amd64 | |
container-package: antelope-spring-experimental-binaries | |
- name: Install .deb packages | |
run: | | |
apt-get update && apt-get -y upgrade | |
apt install -y ./*.deb | |
rm ./*.deb | |
- name: Download EOS EVM Contract | |
uses: AntelopeIO/asset-artifact-download-action@v3 | |
with: | |
owner: eosnetworkfoundation | |
repo: eos-evm | |
target: '${{needs.versions.outputs.eos-evm-contract-target}}' | |
prereleases: ${{fromJSON(needs.versions.outputs.eos-evm-contract-prerelease)}} | |
file: 'contract.tar.gz' | |
artifact-name: contract.test-actions-off.tar.gz | |
- name: Extract EOS EVM Contract | |
id: evm-contract | |
run: | | |
mkdir contract | |
mv contract.tar.gz contract/ | |
cd contract | |
tar xvf contract.tar.gz | |
cd build | |
echo "EVM_CONTRACT=$(pwd)" >> "$GITHUB_OUTPUT" | |
- name: Build EVM Bridge Contracts | |
run: | | |
pushd evm-bridge-contracts | |
cmake -B build -Deosevm_DIR=${{ steps.evm-contract.outputs.EVM_CONTRACT }} | |
cmake --build build -- -j | |
tar -pc build | zstd --long -T0 -9 > build.tar.zst | |
- name: Upload builddir | |
uses: actions/upload-artifact@v4 | |
with: | |
name: builddir | |
path: evm-bridge-contracts/build.tar.zst | |
compression-level: 0 | |
- name: EVM Bridge Contracts Tests | |
run: | | |
pushd evm-bridge-contracts/build | |
ctest --output-on-failure |