Skip to content

Nightly

Nightly #2045

Workflow file for this run

name: Nightly
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
release_version:
description: 'Tag to use for the build. Example: v1.0.0. *Null = master'
required: false
default: ''
latest:
description: 'Tag as latest ?'
type: boolean
required: false
default: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
TERM: xterm-256color
CARGO_TERM_COLOR: always
RUST_BACKTRACE: short
RUSTUP_TOOLCHAIN: nightly-2025-10-20
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: eu-central-1
AWS_BUCKET: gear-builds
jobs:
build:
name: ${{ matrix.binary }} / ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Gear - Linux x86_64
- binary: gear
os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
deb_target: amd64
file_ext: tar.xz
# Gear - Linux ARM64
- binary: gear
os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
deb_target: arm64
file_ext: tar.xz
# Gear - macOS x86_64
- binary: gear
os: macos-latest
target: x86_64-apple-darwin
file_ext: tar.xz
# Gear - macOS ARM64
- binary: gear
os: macos-latest
target: aarch64-apple-darwin
file_ext: tar.xz
# Gear - Windows
- binary: gear
os: windows-latest
target: x86_64-pc-windows-msvc
file_ext: zip
# Ethexe - Linux x86_64
- binary: ethexe
os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
deb_target: amd64
file_ext: tar.xz
# Ethexe - Linux ARM64
- binary: ethexe
os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
deb_target: arm64
file_ext: tar.xz
# Ethexe - macOS x86_64
- binary: ethexe
os: macos-latest
target: x86_64-apple-darwin
file_ext: tar.xz
# Ethexe - macOS ARM64
- binary: ethexe
os: macos-latest
target: aarch64-apple-darwin
file_ext: tar.xz
# Ethexe - Windows
- binary: ethexe
os: windows-latest
target: x86_64-pc-windows-msvc
file_ext: zip
continue-on-error: true
steps:
- name: Enable long paths on Windows
if: runner.os == 'Windows'
run: git config --global core.longpaths true
- name: Checkout `gear-tech/gear`
uses: actions/checkout@v6
with:
repository: gear-tech/gear
ref: ${{ github.event.inputs.release_version || 'master' }}
submodules: recursive
- name: Set artifact names and Debian version
shell: bash
run: |
echo "ARTIFACT_NAME=${{ matrix.binary }}-${{ github.event.inputs.release_version || 'nightly' }}-${{ matrix.target }}.${{ matrix.file_ext }}" >> $GITHUB_ENV
echo "DEB_ARTIFACT_NAME=${{ matrix.binary }}-${{ github.event.inputs.release_version || 'nightly' }}-${{ matrix.target }}.deb" >> $GITHUB_ENV
BASE_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "${{ matrix.binary }}-cli") | .version')
if [ -n "${{ github.event.inputs.release_version }}" ]; then
DEB_VERSION="${BASE_VERSION}"
else
DEB_VERSION="${BASE_VERSION}~nightly.$(date -u +%Y%m%d).git$(git rev-parse --short HEAD)"
fi
echo "DEB_VERSION=${DEB_VERSION}" >> $GITHUB_ENV
echo "APTLY_DEB_ARTIFACT_NAME=aptly-${{ matrix.binary }}-cli_${DEB_VERSION}_${{ matrix.deb_target }}.deb" >> $GITHUB_ENV
- name: Checkout `gear-tech/builds` (for patch)
uses: actions/checkout@v6
with:
path: builds
# =========== Rust Toolchain Setup ===========
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUSTUP_TOOLCHAIN }}
targets: wasm32v1-none
- name: Add target
shell: bash
run: rustup target add ${{ matrix.target }}
- name: List toolchains and targets
run: |
rustup toolchain list
rustup target list --installed
# =========== Cache ===========
- name: Cache Cargo registry (non-ARM)
if: runner.arch != 'ARM64'
uses: actions/cache@v5
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Cache Cargo registry (ARM)
if: runner.arch == 'ARM64'
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-arm64-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-arm64-cargo-registry-
- name: Cache Cargo build
uses: actions/cache@v5
with:
path: target
key: ${{ runner.os }}-${{ matrix.target }}-${{ matrix.binary }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.target }}-${{ matrix.binary }}-cargo-build-
# =========== Dependencies ===========
- name: Fix git safe directory
if: runner.os == 'Linux'
run: git config --global --add safe.directory $(pwd)
# TODO: swicth back to `arduino/setup-protoc@v3` after it supports Node 24
# https://github.com/arduino/setup-protoc/pull/113
- name: Install Protoc
uses: StackOverflowExcept1on/setup-protoc@3c8638272249639ffb4bc8571caff93ee0383579
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Linux packages
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler libssl-dev pkg-config
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall --no-confirm cargo-deb
- name: Install macOS packages
if: runner.os == 'macOS'
run: |
brew list --versions protobuf >/dev/null 2>&1 || brew install protobuf
brew list --versions openssl@3 >/dev/null 2>&1 || brew install openssl@3
- name: "Install: Setup MSYS2 environment (Windows)"
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
path-type: inherit
install: procps
- name: "Install: Packages from Scoop (Windows)"
if: runner.os == 'Windows'
uses: MinoruSekine/setup-scoop@v4.0.2
with:
apps: >-
perl
binaryen
wabt
protobuf
buckets: extras
- name: "Install: Set `OPENSSL_SRC_PERL` environment variable (Windows)"
if: runner.os == 'Windows'
run: |
$perl = Resolve-Path "~\scoop\apps\perl\current\perl\bin\perl.exe"
Add-Content -Path $Env:GITHUB_ENV -Value "OPENSSL_SRC_PERL=$perl"
shell: powershell
# =========== Build ===========
- name: Build Binary
shell: bash
run: cargo build --package ${{ matrix.binary }}-cli --profile production --target ${{ matrix.target }}
- name: Build Debian package (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
cargo deb --package ${{ matrix.binary }}-cli --profile production --target ${{ matrix.target }} --deb-version "${{ env.DEB_VERSION }}"
DEB_PATH=$(find target -path '*/debian/${{ matrix.binary }}-cli_*.deb' -print -quit)
if [ -z "$DEB_PATH" ]; then
echo "Debian package was not found"
exit 1
fi
cp "$DEB_PATH" "${{ env.DEB_ARTIFACT_NAME }}"
cp "$DEB_PATH" "${{ env.APTLY_DEB_ARTIFACT_NAME }}"
# =========== Package ===========
- name: Package Linux
if: runner.os == 'Linux'
shell: bash
run: |
cd target/${{ matrix.target }}/production
XZ_OPT=-9 tar -cvJf "../../../${{ env.ARTIFACT_NAME }}" ${{ matrix.binary }}
- name: Package macOS
if: runner.os == 'macOS'
shell: bash
run: |
cd target/${{ matrix.target }}/production
tar -cvJf "../../../${{ env.ARTIFACT_NAME }}" ${{ matrix.binary }}
- name: Package Windows
if: runner.os == 'Windows'
shell: bash
run: |
cd target/${{ matrix.target }}/production
7z a "../../../${{ env.ARTIFACT_NAME }}" ${{ matrix.binary }}.exe
# =========== Upload ===========
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_NAME }}
if-no-files-found: warn
compression-level: 0
overwrite: false
- name: Upload Debian package
if: runner.os == 'Linux'
uses: actions/upload-artifact@v7
with:
name: ${{ env.DEB_ARTIFACT_NAME }}
path: ${{ env.DEB_ARTIFACT_NAME }}
if-no-files-found: error
compression-level: 0
overwrite: false
- name: Upload Debian package (aptly)
if: runner.os == 'Linux'
uses: actions/upload-artifact@v7
with:
name: ${{ env.APTLY_DEB_ARTIFACT_NAME }}
path: ${{ env.APTLY_DEB_ARTIFACT_NAME }}
if-no-files-found: error
compression-level: 0
overwrite: false
publish:
name: Publish artifacts
needs: build
runs-on: ubuntu-24.04
steps:
- name: Checkout `gear-tech/builds`
uses: actions/checkout@v6
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "26"
cache: "npm"
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: artifact
merge-multiple: true
- name: List artifacts
run: ls -la artifact/
- name: AWS login
uses: aws-actions/configure-aws-credentials@v6
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Delete old nightly artifacts
if: github.event.inputs.release_version == ''
run: |
aws s3 rm s3://${{ env.AWS_BUCKET }}/ --recursive --exclude "*" --include "gear-nightly*"
aws s3 rm s3://${{ env.AWS_BUCKET }}/ --recursive --exclude "*" --include "ethexe-nightly*"
- name: Publish artifacts
run: |
aws s3 sync ./artifact/ s3://${{ env.AWS_BUCKET }}/ --exclude "*" --include "gear-*" --include "ethexe-*"
- name: Publish nightly Debian packages to APT repo
if: github.event.inputs.release_version == ''
shell: bash
env:
APTLY_API_URL: ${{ secrets.APTLY_API_URL }}
APTLY_API_GPG_PASSWORD: ${{ secrets.APTLY_API_GPG_PASSWORD }}
APTLY_API_AUTHORIZATION_HEADER: ${{ secrets.APTLY_API_AUTHORIZATION_HEADER }}
run: |
DIR="nightly"
NAME="nightly"
find artifact -maxdepth 1 -type f -name "aptly-*.deb" -print0 |
while IFS= read -r -d '' deb_path; do
FILE=$(basename "$deb_path")
DIR_AND_FILE=$(curl -fsSL -u "$APTLY_API_AUTHORIZATION_HEADER" -X POST -F "file=@$deb_path;filename=$FILE" "$APTLY_API_URL/api/files/$DIR" | jq -r '.[0]')
echo "$DIR_AND_FILE"
curl -fsSL -u "$APTLY_API_AUTHORIZATION_HEADER" -X POST "$APTLY_API_URL/api/repos/$NAME/file/$DIR_AND_FILE" | jq -r '.Report.Added[]'
done
curl -fsSL -u "$APTLY_API_AUTHORIZATION_HEADER" -X PUT -H "Content-Type: application/json" -d '{"Signing": {"Passphrase": "'"$APTLY_API_GPG_PASSWORD"'"}}' "$APTLY_API_URL/api/publish/:./nightly"
- name: Update latest symlinks for release
if: >
github.event.inputs.release_version != '' &&
github.event.inputs.latest == 'true'
shell: bash
run: |
find artifact -maxdepth 1 -type f \( -name "gear-${{ github.event.inputs.release_version }}-*" -o -name "ethexe-${{ github.event.inputs.release_version }}-*" \) -print0 |
while IFS= read -r -d '' artifact; do
key=$(basename "$artifact")
latest_key=${key/${{ github.event.inputs.release_version }}/latest}
aws s3api put-object --bucket ${{ env.AWS_BUCKET }} --key "$latest_key" --website-redirect-location "/$key"
done
- name: Generate static
run: |
npm ci
npm run gen:builds
- name: Publish static to S3
run: aws s3 sync ./src/ s3://${{ env.AWS_BUCKET }}/