Skip to content

chore: adapt codebase to latest Rust (1.75) #34

chore: adapt codebase to latest Rust (1.75)

chore: adapt codebase to latest Rust (1.75) #34

Workflow file for this run

name: Release Tag
on:
push:
tags:
- '*'
jobs:
#?####################################################################################################?#
#? ?#
#? Build Helper Images ?#
#? ?#
#?####################################################################################################?#
aarch64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build-helper
name: Building Docker Image
with:
imagename: aarch64-unknown-linux-gnu
armv7:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build-helper
name: Building Docker Image
with:
imagename: armv7-unknown-linux-gnueabihf
x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build-helper
name: Building Docker Image
with:
imagename: x86_64-unknown-linux-gnu
macos_helper:
runs-on: ubuntu-latest
steps:
- run: exit 0
windows_helper:
runs-on: ubuntu-latest
steps:
- run: exit 0
#?####################################################################################################?#
#? ?#
#? Build Releases ?#
#? ?#
#?####################################################################################################?#
Build_aarch64:
needs: [aarch64]
runs-on: ubuntu-latest
steps:
# Checkout Repo
- uses: actions/checkout@v3
# Download Images & Build Binary
- uses: ./.github/actions/build-linux
name: Building aarch64 Binary
with:
target: aarch64-unknown-linux-gnu
# Upload Build Releases
- uses: actions/upload-artifact@v3
with:
name: aarch64-release
path: |
target/aarch64-unknown-linux-gnu/release/witnet
target/aarch64-unknown-linux-gnu/release/witnet_toolkit
Build_armv7:
needs: [armv7]
runs-on: ubuntu-latest
steps:
# Checkout Repo
- uses: actions/checkout@v3
# Download Images & Build Binary
- uses: ./.github/actions/build-linux
name: Building armv7 Binary
with:
target: armv7-unknown-linux-gnueabihf
# Upload Build Releases
- uses: actions/upload-artifact@v3
with:
name: armv7-release
path: |
target/armv7-unknown-linux-gnueabihf/release/witnet
target/armv7-unknown-linux-gnueabihf/release/witnet_toolkit
Build_x86_64:
needs: [x86_64]
runs-on: ubuntu-latest
steps:
# Checkout Repo
- uses: actions/checkout@v3
# Download Images & Build Binary
- uses: ./.github/actions/build-linux
name: Building x86_64 Binary
with:
target: x86_64-unknown-linux-gnu
# Upload Build Releases
- uses: actions/upload-artifact@v3
with:
name: x86_64-release
path: |
target/x86_64-unknown-linux-gnu/release/witnet
target/x86_64-unknown-linux-gnu/release/witnet_toolkit
Build_macOs:
needs: [macos_helper]
runs-on: macos-latest
steps:
# Checkout Repo
- uses: actions/checkout@v3
# Install Protobuf
- name: Install Protobuf
run: brew install protobuf
# MacOS Build
- name: Building Macos Binary
run: MACOSX_DEPLOYMENT_TARGET=10.14 OPENSSL_STATIC=1 OPENSSL_DIR="/usr/local/opt/openssl" cargo build --release -p witnet -p witnet_toolkit
# Upload Build Releases
- uses: actions/upload-artifact@v3
with:
name: macos-release
path: |
target/release/witnet
target/release/witnet_toolkit
Build_windows:
needs: [windows_helper]
runs-on: windows-latest
steps:
# Checkout Repo
- uses: actions/checkout@v3
# Install Protobuf
- name: Install Protobuf
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/releases/download/v21.1/protoc-21.1-win64.zip -OutFile "protoc.zip"
Expand-Archive -Path protoc.zip -DestinationPath C:\protoc -force
echo "C:\protoc\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# TODO: Needs to be optimized takes wayyyy too long
# Install openssl static
- name: Install openssl static
run: |
vcpkg.exe install openssl:x64-windows-static
vcpkg.exe integrate install
# Windows Build
- name: Build Windows
run: |
Set-Variable -Name "OPENSSL_STATIC" -Value "1"
Set-Variable -Name "OPENSSL_DIR" -Value "C:\Program Files\vcpkg\installed\x64-windows-static"
cargo build --release -p witnet -p witnet_toolkit
# Confirm openssl compiled statically
- name: Confirm openssl compiled statically
run: LDD.exe target\release\witnet.exe | Select-String -Pattern "ssl"
# Upload Build Releases
- uses: actions/upload-artifact@v3
with:
name: windows-release
path: |
target\release\witnet.exe
target\release\witnet_toolkit.exe
#?####################################################################################################?#
#? ?#
#? Sign & Publish ?#
#? ?#
#?####################################################################################################?#
Sign:
needs: [Build_windows, Build_macOs, Build_x86_64, Build_armv7, Build_aarch64]
runs-on: ubuntu-latest
environment: tags
steps:
# Checkout Repo
- uses: actions/checkout@v3
# Download Releases
- uses: ./.github/actions/download-releases
name: Downloading Artifacts
# Import GPG Key
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
# Trust GPG key
- name: Trust GPG key
run: |
gpg --no-tty --command-fd 0 --edit-key [email protected] << EOTRUST
trust
5
y
quit
EOTRUST
- name: Sign Hashes
run: |
cd release
gpg --output SHA256SUMS.asc --default-key [email protected] --detach-sig --clearsign SHA256SUMS && rm SHA256SUMS
# Artifact Final Release Files
- uses: actions/upload-artifact@v3
with:
name: final-release
path: release/
Release:
needs: [Sign]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Checkout Repo
- uses: actions/checkout@v3
# Download Release Files
- uses: actions/download-artifact@v3
with:
name: final-release
path: release/
# Replace tag in RELEASE.md
- run: |
TAG=${{github.ref_name}}
sed -i "s/LATEST_VERSION/$TAG/g" RELEASE.md
# Publish new github release
- uses: ncipollo/release-action@v1
with:
name: "Witnet-rust ${{github.ref_name}}"
artifacts: "./release/*"
bodyFile: "RELEASE.md"
artifactErrorsFailBuild: true
Publish:
needs: [Release]
runs-on: ubuntu-latest
environment: tags
steps:
# Checkout Repo
- uses: actions/checkout@v3
- name: Login to Docker Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# Configure Buildx
- 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)
- 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
- 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