forked from witnet/witnet-rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
147 additions
and
61 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Build Binaries | ||
description: "Builds Linux Binaries" | ||
|
||
inputs: | ||
target: | ||
description: Build target architecture | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# Download Helper Image built in the previous jobs | ||
- name: Downloading helper Image | ||
uses: ishworkh/container-image-artifact-download@v2.0.0 | ||
with: | ||
image: "witnet-rust/${{ inputs.target }}:latest" | ||
|
||
- name: Export Vars | ||
shell: bash | ||
run: | | ||
echo PWD=`pwd` >> $GITHUB_ENV | ||
echo TARGET=${{ inputs.target }} >> $GITHUB_ENV | ||
- name: Build Binary | ||
shell: bash | ||
run: docker run -v `pwd`:/project:ro -v `pwd`/target:/target -v ~/.cargo:/root/.cargo -w /project -i witnet-rust/$TARGET bash -c "cargo build --release --target=$TARGET --target-dir=/target -p witnet-centralized-ethereum-bridge" | ||
|
||
- name: List Directory | ||
shell: bash | ||
run: ls -lsa ./target/${{ inputs.target }}/release |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,130 @@ | ||
name: Bridge | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Release Tag"] | ||
types: [completed] | ||
workflow_dispatch: | ||
inputs: | ||
force: | ||
description: 'Force execution of this action' | ||
type: boolean | ||
required: false | ||
default: true | ||
push: | ||
tags: | ||
- '*-bridge*' | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
Bridge: | ||
#?####################################################################################################?# | ||
#? ?# | ||
#? Build Helper Images ?# | ||
#? ?# | ||
#?####################################################################################################?# | ||
aarch64: | ||
runs-on: ubuntu-latest | ||
environment: tags | ||
if: ${{ github.event.workflow_run.conclusion == 'success' || inputs.force }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Protobuf | ||
run: | | ||
sudo apt install -y protobuf-compiler | ||
protoc --version | ||
- name: Build witnet-centralized-ethereum-bridge | ||
run: | | ||
cargo build -p witnet-centralized-ethereum-bridge --release | ||
- name: Move file to outside docker ignored | ||
run: | | ||
cp target/release/witnet-centralized-ethereum-bridge ./ | ||
- name: Check Pre-release | ||
run: | | ||
TAG=${{ github.ref_name }} | ||
if [[ "$TAG" =~ - ]]; then | ||
echo "prerelease=true" >> $GITHUB_ENV | ||
else | ||
echo "prerelease=false" >> $GITHUB_ENV | ||
fi | ||
- name: Set Version | ||
run: | | ||
echo VERNUM=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9\.]+)?)"/\1/p' ./bridges/centralized-ethereum/Cargo.toml | head -1) >> $GITHUB_ENV | ||
- name: Login to Docker hub Registry | ||
uses: docker/login-action@v3 | ||
- name: Building Docker Image | ||
uses: ./.github/actions/build-helper | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build & Push Tag Image | ||
run: | | ||
docker build -t witnet/witnet-centralized-ethereum-bridge:"$VERNUM" -f ./docker/bridge/Dockerfile . | ||
docker push witnet/witnet-centralized-ethereum-bridge:"$VERNUM" | ||
- name: Build & Push Latest if not Pre-Release | ||
run: | | ||
docker build -t witnet/witnet-centralized-ethereum-bridge:latest -f ./docker/bridge/Dockerfile . | ||
docker push witnet/witnet-centralized-ethereum-bridge:latest | ||
if: env.prerelease == 'false' | ||
|
||
|
||
Failure: | ||
imagename: aarch64-unknown-linux-gnu | ||
|
||
x86_64: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Building Docker Image | ||
uses: ./.github/actions/build-helper | ||
with: | ||
imagename: x86_64-unknown-linux-gnu | ||
|
||
#?####################################################################################################?# | ||
#? ?# | ||
#? Build Releases ?# | ||
#? ?# | ||
#?####################################################################################################?# | ||
|
||
Build_aarch64: | ||
needs: [aarch64] | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'failure' }} | ||
steps: | ||
- run: echo '(Release Tag) workflow failed, EXITING!!!!' && exit 1 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Building aarch64 Binary | ||
uses: ./.github/actions/build-bridge | ||
with: | ||
target: aarch64-unknown-linux-gnu | ||
|
||
- name: see path | ||
run: cd target && tree | ||
|
||
- name: Upload Build | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: aarch64-release | ||
path: | | ||
target/aarch64-unknown-linux-gnu/release/witnet-centralized-ethereum-bridge | ||
Build_x86_64: | ||
needs: [x86_64] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Building x86_64 Binary | ||
uses: ./.github/actions/build-bridge | ||
with: | ||
target: x86_64-unknown-linux-gnu | ||
|
||
- name: see path | ||
run: cd target && tree | ||
|
||
- name: Upload Build | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: x86_64-release | ||
path: | | ||
target/x86_64-unknown-linux-gnu/release/witnet-centralized-ethereum-bridge | ||
#?####################################################################################################?# | ||
#? ?# | ||
#? Sign & Publish ?# | ||
#? ?# | ||
#?####################################################################################################?# | ||
# Publish: | ||
# needs: [Build_aarch64, Build_x86_64] | ||
# runs-on: ubuntu-latest | ||
# environment: tags | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Login to Docker Container Registry | ||
# uses: docker/login-action@v3 | ||
# with: | ||
# username: ${{ secrets.DOCKER_USERNAME }} | ||
# password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
# - name: Build Base | ||
# run: | | ||
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
# docker buildx create --name multiarch --driver docker-container --use | ||
# docker buildx inspect --bootstrap | ||
|
||
# # Build Docker images (Latest & TAG) | ||
# - name: Build TAG | ||
# run: docker buildx build -f docker/witnet-rust/Dockerfile --progress=plain --build-arg WITNET_VERSION=${{github.ref_name}} --platform linux/amd64,linux/arm64,linux/arm/v7 --tag witnet/witnet-rust:${{github.ref_name}} docker/witnet-rust --push --no-cache | ||
|
||
# - name: Check Pre-release | ||
# run: | | ||
# TAG=${{ github.ref_name }} | ||
# if [[ "$TAG" =~ - ]]; then | ||
# echo "prerelease=true" >> $GITHUB_ENV | ||
# else | ||
# echo "prerelease=false" >> $GITHUB_ENV | ||
# fi | ||
|
||
# - name: Build Latest if not Pre-Release | ||
# run: docker buildx build -f docker/witnet-rust/Dockerfile --progress=plain --build-arg WITNET_VERSION=latest --platform linux/amd64,linux/arm64,linux/arm/v7 --tag witnet/witnet-rust:latest docker/witnet-rust --push --no-cache | ||
# if: env.prerelease == 'false' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
push: | ||
tags: | ||
- '*' | ||
- '!*bridge*' | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|