Skip to content

release

release #722

name: release
on:
schedule:
# Runs "At 12:00." (see https://crontab.guru)
- cron: "0 12 * * *"
env:
CARGO_TERM_COLOR: always
defaults:
run:
# necessary for windows
shell: bash
jobs:
build:
if: ${{ false }} # disable for now
strategy:
fail-fast: false
matrix:
# a list of all the targets
include:
- TARGET: x86_64-unknown-linux-gnu
OS: ubuntu-latest
RUST: nightly
- TARGET: x86_64-unknown-linux-musl
OS: ubuntu-latest
RUST: nightly
- TARGET: aarch64-unknown-linux-gnu
OS: ubuntu-latest
RUST: nightly
# - TARGET: aarch64-unknown-linux-musl
# OS: ubuntu-latest
# RUST: nightly
# if: github.ref != 'refs/heads/master'
runs-on: ${{ matrix.OS }}
env:
TARGET: ${{ matrix.TARGET }}
OS: ${{ matrix.OS }}
# Disable full debug symbol generation to speed up CI build and keep memory down
# "1" means line tables only, which is useful for panic tracebacks.
RUSTFLAGS: "-C debuginfo=1"
steps:
- uses: actions/checkout@v2
- name: Cache Cargo
uses: actions/cache@v2
with:
# these represent dependencies downloaded by cargo
# and thus do not depend on the OS, arch nor rust version.
path: ~/.cargo
key: cargo-cache-
- name: Cache Rust dependencies
uses: actions/cache@v2
with:
# these represent compiled steps of both dependencies and arrow
# and thus are specific for a particular OS, arch and rust version.
path: target
key: ${{ runner.os }}-${{ matrix.TARGET }}-target-cache-${{ matrix.RUST }}-
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2022-01-20
override: true
components: rustfmt
# - name: update all third-party dependencies
# run: |
# cargo update
- name: Install and configure dependencies
run: |
# dependencies are only needed on ubuntu as that's the only place where
# we make cross-compilation
if [[ $OS =~ ^ubuntu.*$ ]]; then
sudo apt install musl-tools
sudo apt-get install -qq crossbuild-essential-arm64 crossbuild-essential-armhf
wget http://more.musl.cc/$(uname -m)-linux-musl/aarch64-linux-musl-cross.tgz
tar -xvf aarch64-linux-musl-cross.tgz
sudo mv aarch64-linux-musl-cross /opt/
echo 'export PATH=/opt/aarch64-linux-musl-cross/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
fi
# some additional configuration for cross-compilation on linux
cat >~/.cargo/config <<EOF
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
[target.aarch64-unknown-linux-musl]
linker = "/opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc"
ar = "/opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc-ar"
rustflags = [ "-L /opt/aarch64-linux-musl-cross/aarch64-linux-musl/lib", "-C", "link-arg=-lgcc", "-C", "link-arg=/opt/aarch64-linux-musl-cross/aarch64-linux-musl/lib/libc.a" ]
EOF
- name: Install rust target
run: rustup target add $TARGET
- name: Run build
run: |
rustup default nightly-2022-01-20
cargo build --release --verbose --target $TARGET --features "simd mimalloc"
env:
CARGO_HOME: "~/.cargo"
CARGO_TARGET_DIR: "target"
CC_aarch64-unknown-linux-musl: "/opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc"
- name: List target
run: find ./target || true
- name: Compress
run: |
mkdir -p ./artifacts
if [[ $GITHUB_REF_TYPE =~ ^tag$ ]]; then
TAG=$GITHUB_REF_NAME
else
TAG=$GITHUB_SHA
fi
if [ "$TARGET" == "aarch64-unknown-linux-gnu" ]; then
aarch64-linux-gnu-strip --strip-all ./target/$TARGET/release/flock
else
strip --strip-all ./target/$TARGET/release/flock
fi
mv header license
tar -czf ./artifacts/flock-$TARGET-$TAG.tar.gz ./target/$TARGET/release/flock ./target/$TARGET/release/flock-cli license
- name: Archive artifact
uses: actions/upload-artifact@v2
with:
name: result
path: |
./artifacts
# deploys to github releases on tag
deploy:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: result
path: ./artifacts
- name: List
run: find ./artifacts || true
- name: Release
uses: softprops/action-gh-release@v1
with:
files: ./artifacts/*.tar.gz