Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci update and refactor all actions #2487

Open
wants to merge 8 commits into
base: 2.0-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/build-helper/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ runs:
run: docker build -t witnet-rust/${{ inputs.imagename }}:latest -f ./docker/cross-compilation/${{ inputs.imagename }}/Dockerfile ./docker/cross-compilation/

- name: Upload image
uses: ishworkh/docker-image-artifact-upload@v1
uses: ishworkh/container-image-artifact-upload@v2.0.0
with:
image: "witnet-rust/${{ inputs.imagename }}:latest"
14 changes: 7 additions & 7 deletions .github/actions/build-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ runs:
steps:
# Download Helper Image built in the previous jobs
- name: Downloading helper Image
uses: ishworkh/docker-image-artifact-download@v1
uses: ishworkh/container-image-artifact-download@v2.0.0
with:
image: "witnet-rust/${{ inputs.target }}:latest"

# Export Vars
- shell: bash
- name: Export Vars
shell: bash
run: |
echo PWD=`pwd` >> $GITHUB_ENV
echo TARGET=${{ inputs.target }} >> $GITHUB_ENV

# Run Binary Build
- shell: bash
- 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 -p witnet_toolkit"

# Show Directory listing
- shell: bash
- name: List Directory
shell: bash
run: ls -lsa ./target/${{ inputs.target }}/release
36 changes: 18 additions & 18 deletions .github/actions/download-releases/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ description: "Download All releases artifacted from the previous jobs & Signs"
runs:
using: "composite"
steps:
# Make Directory
- shell: bash
- name: Create Release Directory
shell: bash
run: mkdir release

# Download Genesis Block
- shell: bash
- name: Download Gensis Block
shell: bash
run: |
curl "https://raw.githubusercontent.com/witnet/genesis_block/master/latest/genesis_block.json" -o genesis_block.json
cp genesis_block.json release/
cp witnet.toml release/

# Download & Hash Releases
# Macos
- uses: actions/download-artifact@v3
- name: Download MacOS Build
uses: actions/download-artifact@v4
with:
name: macos-release
path: all-releases/macos/
Expand All @@ -28,8 +28,8 @@ runs:
cp witnet.toml ./all-releases/macos/
mv all-releases/macos/witnet_toolkit release/witnet_toolkit-x86_64-apple-darwin

# Windows
- uses: actions/download-artifact@v3
- name: Download Windows Build
uses: actions/download-artifact@v4
with:
name: windows-release
path: all-releases/windows/
Expand All @@ -40,8 +40,8 @@ runs:
cp witnet.toml ./all-releases/windows/
mv all-releases/windows/witnet_toolkit.exe release/witnet_toolkit-x86_64-pc-windows-msvc.exe

# x86_64
- uses: actions/download-artifact@v3
- name: Download x86_64 Build
uses: actions/download-artifact@v4
with:
name: x86_64-release
path: all-releases/x86_64/
Expand All @@ -52,8 +52,8 @@ runs:
cp witnet.toml ./all-releases/x86_64/
mv all-releases/x86_64/witnet_toolkit release/witnet_toolkit-x86_64-unknown-linux-gnu

# armv7
- uses: actions/download-artifact@v3
- name: Download armv7 Build
uses: actions/download-artifact@v4
with:
name: armv7-release
path: all-releases/armv7/
Expand All @@ -64,8 +64,8 @@ runs:
cp witnet.toml ./all-releases/armv7/
mv all-releases/armv7/witnet_toolkit release/witnet_toolkit-armv7-unknown-linux-gnueabihf

# aarch64
- uses: actions/download-artifact@v3
- name: Download aarch64 Build
uses: actions/download-artifact@v4
with:
name: aarch64-release
path: all-releases/aarch64/
Expand All @@ -76,17 +76,17 @@ runs:
cp witnet.toml ./all-releases/aarch64/
mv all-releases/aarch64/witnet_toolkit release/witnet_toolkit-aarch64-unknown-linux-gnu

# tar Releases
- shell: bash
- name: Tar Releases
shell: bash
run: |
tar -czvf release/witnet-${{github.ref_name}}-x86_64-apple-darwin.tar.gz -C all-releases/macos/ .
tar -czvf release/witnet-${{github.ref_name}}-x86_64-pc-windows-msvc.tar.gz -C all-releases/windows/ .
tar -czvf release/witnet-${{github.ref_name}}-x86_64-unknown-linux-gnu.tar.gz -C all-releases/x86_64/ .
tar -czvf release/witnet-${{github.ref_name}}-armv7-unknown-linux-gnueabihf.tar.gz -C all-releases/armv7/ .
tar -czvf release/witnet-${{github.ref_name}}-aarch64-unknown-linux-gnu.tar.gz -C all-releases/aarch64/ .

# Sign Tars
- shell: bash
- name: Sign Tars
shell: bash
run: |
cd release
sha256sum genesis_block.json >>SHA256SUMS
Expand Down
14 changes: 7 additions & 7 deletions .github/actions/versions-match/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ runs:
using: "composite"
steps:
# Perform the version matching
- shell: bash
- name: Verify Matching Versions
shell: bash
run: |
echo "Checking version of subcrate \"${{ inputs.subcrate }}\""
MAIN_VERSION=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]\.[0-9])"/\1/p' ./Cargo.toml | head -1)
SUBCRATE_VERSION=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]\.[0-9])"/\1/p' ./${{ inputs.subcrate }}/Cargo.toml | head -1)
if [[ "$SUBCRATE_VERSION" != "$MAIN_VERSION" ]]; \
then \
echo "Version of subcrate \"${{ inputs.subcrate }}\" ($SUBCRATE_VERSION) does not match that of main crate ($MAIN_VERSION)"; \
exit 10; \
MAIN_VERSION=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?)"/\1/p' ./Cargo.toml | head -1)
SUBCRATE_VERSION=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?)"/\1/p' ./${{ inputs.subcrate }}/Cargo.toml | head -1)
if [[ "$SUBCRATE_VERSION" != "$MAIN_VERSION" ]]; then
echo "Version of subcrate \"${{ inputs.subcrate }}\" ($SUBCRATE_VERSION) does not match that of main crate ($MAIN_VERSION)"
exit 10
fi
34 changes: 24 additions & 10 deletions .github/workflows/bridge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ on:
required: false
default: true

env:
CARGO_TERM_COLOR: always

jobs:
Bridge:
runs-on: ubuntu-latest
environment: tags
if: ${{ github.event.workflow_run.conclusion == 'success' || inputs.force }}
steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v4

- name: Install Protobuf
run: |
Expand All @@ -33,26 +37,36 @@ jobs:
run: |
cp target/release/witnet-centralized-ethereum-bridge ./

- name: Set Version
- name: Check Pre-release
run: |
echo VERNUM=$(sed -nE 's/version\s?=\s?"([0-9]+\.[0-9]\.[0-9])"/\1/p' ./bridges/centralized-ethereum/Cargo.toml | head -1) >> $GITHUB_ENV
TAG=${{ github.ref_name }}
if [[ "$TAG" =~ - ]]; then
echo "prerelease=true" >> $GITHUB_ENV
else
echo "prerelease=false" >> $GITHUB_ENV
fi

- name: Build docker Image
- name: Set Version
run: |
docker build -t witnet/witnet-centralized-ethereum-bridge:"$VERNUM" -f ./docker/bridge/Dockerfile .
docker build -t witnet/witnet-centralized-ethereum-bridge:latest -f ./docker/bridge/Dockerfile .
docker image ls

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@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push Image
- 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:
runs-on: ubuntu-latest
Expand Down
Loading
Loading