Skip to content

Commit

Permalink
ci: build & upload binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanFlurry committed Dec 19, 2024
1 parent 35ec903 commit 601d70d
Show file tree
Hide file tree
Showing 2 changed files with 195 additions and 75 deletions.
120 changes: 120 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: build

on:
push:
branches:
- main
tags:
- '*'
# For testing:
pull_request:

permissions: {}

defaults:
run:
# Enable fail-fast behavior
shell: bash -e {0}

env:
# Disable incremental compilation for faster from-scratch builds
CARGO_INCREMENTAL: 0
RUSTFLAGS: "--cfg tokio_unstable"

jobs:
build-and-upload:
strategy:
matrix:
include:
- platform: x86_64-unknown-linux-gnu
runner: [self-hosted, Linux, X64]
suffix: x86-linux
# - platform: x86_64-pc-windows-gnu
# runner: [self-hosted, Linux, X64]
# suffix: x86-windows
# - platform: x86_64-apple-darwin
# runner: [self-hosted, Linux, X64]
# suffix: x86-mac
# - platform: aarch64-apple-darwin
# runner: [self-hosted, Linux, ARM64]
# suffix: aarch64-max
runs-on: ${{ matrix.runner }}
container:
image: rust:1.82.0
steps:
- uses: actions/checkout@v4
# - name: Setup Cross-Compiling Environment
# run: |
# # Install required components for each platform
# apt-get update
# if [[ "${{ matrix.platform }}" == "x86_64-pc-windows-gnu" ]]; then
# echo "Installing Windows components"
#
# apt-get install -y gcc-mingw-w64-x86-64
# elif [[ "${{ matrix.platform }}" == "x86_64-unknown-linux-gnu" ]]; then
# echo "Installing Linux components"
#
# apt-get install -y gcc-x86-64-linux-gnu libc6-dev-amd64-cross
# elif [[ "${{ matrix.platform }}" == "x86_64-apple-darwin" || "${{ matrix.platform }}" == "aarch64-apple-darwin" ]]; then
# echo "Installing macOS components"
#
# apt-get install -y clang libssl-dev wget xz-utils cmake patch libxml2-dev llvm-dev uuid-dev curl unzip
# # Install osxcross
# git config --global --add safe.directory '*'
# git clone https://github.com/tpoechtrager/osxcross /root/osxcross
# cd /root/osxcross
# wget -nc https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz
# mv MacOSX11.3.sdk.tar.xz tarballs/
# UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
# export PATH="/root/osxcross/target/bin:$PATH"
# fi
#
# # Install targets
# rustup target add ${{ matrix.platform }}
#
# mkdir -p /root/.cargo && \
# echo '\
# [target.x86_64-unknown-linux-gnu]\n\
# linker = "x86_64-linux-gnu-gcc"\n\
# \n\
# [target.x86_64-pc-windows-gnu]\n\
# linker = "x86_64-w64-mingw32-gcc"\n\
# \n\
# [target.x86_64-apple-darwin]\n\
# linker = "x86_64-apple-darwin20.4-clang"\n\
# ar = "x86_64-apple-darwin20.4-ar"\n\
# \n\
# [target.aarch64-apple-darwin]\n\
# linker = "aarch64-apple-darwin20.4-clang"\n\
# ar = "aarch64-apple-darwin20.4-ar"\n\
# ' > /root/.cargo/config.toml
#
# - name: Build
# env:
# # Expose correct target since we're building cross-platform
# OVERRIDE_TARGET: ${{ matrix.platform }}
# run: cargo build --bin rivet --release --target ${{ matrix.platform }}
- name: Upload artifacts
env:
AWS_ACCESS_KEY_ID: ${{ secrets.R2_RELEASES_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_RELEASES_SECRET_ACCESS_KEY }}
run: |
apt-get update
apt-get install -y awscli
aws --version
COMMIT_SHA_SHORT=$(git rev-parse --short HEAD)
BINARY_NAME="rivet-${{ matrix.suffix }}"
if [[ "${{ matrix.platform }}" == "x86_64-pc-windows-gnu" ]]; then
BINARY_NAME="${BINARY_NAME}.exe"
fi
aws s3 cp \
README.md \
"s3://rivet-releases/test" \
--region auto \
--endpoint-url https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com/rivet-releases
# aws s3 cp \
# "target/${{ matrix.platform }}/release/rivet" \
# "s3://rivet-releases/rivet/${COMMIT_SHA_SHORT}/${BINARY_NAME}" \
# --region auto \
# --endpoint-url https://2a94c6a0ced8d35ea63cddc86c2681e7.r2.cloudflarestorage.com/rivet-releases
150 changes: 75 additions & 75 deletions .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
@@ -1,75 +1,75 @@
name: rust

on:
pull_request:
push:
branches:
- main

concurrency:
group: rust-${{ github.ref }}
cancel-in-progress: true

permissions: {}

defaults:
run:
# Enable fail-fast behavior
shell: bash -e {0}

env:
# Disable incremental compilation for faster from-scratch builds
CARGO_INCREMENTAL: 0
RUSTFLAGS: "--cfg tokio_unstable"

jobs:
cargo-fmt:
runs-on: ubuntu-20.04
container:
image: rust:1.82.0
steps:
- uses: actions/checkout@v4
- run: rustup component add rustfmt
- run: cargo fmt --check
- run: cd packages/infra/client && cargo fmt --check

cargo-check-main:
runs-on: [self-hosted, Linux]
container:
image: rust:1.82.0
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get install -y protobuf-compiler libpq-dev
- run: RUSTFLAGS="--cfg tokio_unstable" cargo check --release

cargo-check-infra:
# The FDB version should match `cluster::workflows::server::install::install_scripts::components::fdb::FDB_VERSION`
# TODO(RVT-4168): Copmile libfdb from scratch for ARM
runs-on: [self-hosted, Linux, X64]
container:
image: rust:1.82.0
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get install -y protobuf-compiler libpq-dev curl libclang-dev
curl -Lf -o /lib/libfdb_c.so "https://github.com/apple/foundationdb/releases/download/7.1.60/libfdb_c.x86_64.so"
- run: cd packages/infra/client && RUSTFLAGS="--cfg tokio_unstable" cargo check --release

cargo-deny:
runs-on: ubuntu-20.04
container:
image: rust:1.82.0
steps:
- uses: actions/checkout@v4
- name: cargo deny
uses: EmbarkStudios/cargo-deny-action@v1
- name: cargo deny (packages/infra/client)
uses: EmbarkStudios/cargo-deny-action@v1
with:
manifest-path: packages/infra/client/Cargo.toml

# name: rust
#
# on:
# pull_request:
# push:
# branches:
# - main
#
# concurrency:
# group: rust-${{ github.ref }}
# cancel-in-progress: true
#
# permissions: {}
#
# defaults:
# run:
# # Enable fail-fast behavior
# shell: bash -e {0}
#
# env:
# # Disable incremental compilation for faster from-scratch builds
# CARGO_INCREMENTAL: 0
# RUSTFLAGS: "--cfg tokio_unstable"
#
# jobs:
# cargo-fmt:
# runs-on: ubuntu-20.04
# container:
# image: rust:1.82.0
# steps:
# - uses: actions/checkout@v4
# - run: rustup component add rustfmt
# - run: cargo fmt --check
# - run: cd packages/infra/client && cargo fmt --check
#
# cargo-check-main:
# runs-on: [self-hosted, Linux]
# container:
# image: rust:1.82.0
# steps:
# - uses: actions/checkout@v4
# - name: Install dependencies
# run: |
# apt-get update
# apt-get install -y protobuf-compiler libpq-dev
# - run: RUSTFLAGS="--cfg tokio_unstable" cargo check --release
#
# cargo-check-infra:
# # The FDB version should match `cluster::workflows::server::install::install_scripts::components::fdb::FDB_VERSION`
# # TODO(RVT-4168): Copmile libfdb from scratch for ARM
# runs-on: [self-hosted, Linux, X64]
# container:
# image: rust:1.82.0
# steps:
# - uses: actions/checkout@v4
# - name: Install dependencies
# run: |
# apt-get update
# apt-get install -y protobuf-compiler libpq-dev curl libclang-dev
# curl -Lf -o /lib/libfdb_c.so "https://github.com/apple/foundationdb/releases/download/7.1.60/libfdb_c.x86_64.so"
# - run: cd packages/infra/client && RUSTFLAGS="--cfg tokio_unstable" cargo check --release
#
# cargo-deny:
# runs-on: ubuntu-20.04
# container:
# image: rust:1.82.0
# steps:
# - uses: actions/checkout@v4
# - name: cargo deny
# uses: EmbarkStudios/cargo-deny-action@v1
# - name: cargo deny (packages/infra/client)
# uses: EmbarkStudios/cargo-deny-action@v1
# with:
# manifest-path: packages/infra/client/Cargo.toml
#

0 comments on commit 601d70d

Please sign in to comment.