mirror of
https://git.meli.delivery/meli/meli
synced 2024-11-09 01:10:33 +00:00
876616d45b
Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
91 lines
3.2 KiB
YAML
91 lines
3.2 KiB
YAML
# SPDX-License-Identifier: EUPL-1.2
|
|
name: Build release binary
|
|
|
|
env:
|
|
CARGO_INCREMENTAL: 0
|
|
CARGO_NET_RETRY: 10
|
|
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
|
|
RUSTFLAGS: "-D warnings -W unreachable-pub -W rust-2021-compatibility"
|
|
RUSTUP_MAX_RETRIES: 10
|
|
RUST_BACKTRACE: short
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- v*
|
|
|
|
jobs:
|
|
build:
|
|
name: Build on ${{ matrix.build }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build: [linux-amd64, ]
|
|
include:
|
|
- build: linux-amd64
|
|
os: ubuntu-latest
|
|
rust: stable
|
|
artifact_name: 'meli-linux-amd64'
|
|
target: x86_64-unknown-linux-gnu
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- id: os-deps
|
|
name: install OS dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y libdbus-1-dev pkg-config mandoc libssl-dev
|
|
#- id: cache-rustup
|
|
# name: Cache Rust toolchain
|
|
# uses: https://github.com/actions/cache@v3
|
|
# with:
|
|
# path: ~/.rustup
|
|
# key: toolchain-${{ matrix.os }}-${{ matrix.rust }}
|
|
#- if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }}
|
|
- id: rustup-setup
|
|
name: Install rustup and toolchains
|
|
shell: bash
|
|
run: |
|
|
if ! command -v rustup &>/dev/null; then
|
|
curl --proto '=https' --tlsv1.2 --retry 10 --retry-connrefused --location --silent --show-error --fail "https://sh.rustup.rs" | sh -s -- --default-toolchain none -y
|
|
source "${HOME}/.cargo/env"
|
|
echo "${CARGO_HOME:-$HOME/.cargo}/bin" >> $GITHUB_PATH
|
|
rustup toolchain install --profile minimal ${{ matrix.rust }} --target ${{ matrix.target }}
|
|
fi
|
|
- name: Configure cargo data directory
|
|
# After this point, all cargo registry and crate data is stored in
|
|
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
|
|
# that are needed during the build process. Additionally, this works
|
|
# around a bug in the 'cache' action that causes directories outside of
|
|
# the workspace dir to be saved/restored incorrectly.
|
|
run: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
|
|
#- id: cache-cargo
|
|
# name: Cache cargo configuration and installations
|
|
# uses: https://github.com/actions/cache@v3
|
|
# with:
|
|
# path: ${{ env.CARGO_HOME }}
|
|
# key: cargo-${{ matrix.os }}-${{ matrix.rust }}
|
|
#- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
|
|
- name: Setup Rust target
|
|
run: |
|
|
mkdir -p "${{ env.CARGO_HOME }}"
|
|
cat << EOF > "${{ env.CARGO_HOME }}"/config.toml
|
|
[build]
|
|
target = "${{ matrix.target }}"
|
|
EOF
|
|
- name: Build binary
|
|
run: |
|
|
make
|
|
mkdir artifacts
|
|
mv target/*/release/* target/ || true
|
|
mv target/release/* target/ || true
|
|
mv target/meli artifacts/
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ matrix.artifact_name }}
|
|
path: artifacts/meli
|
|
if-no-files-found: error
|
|
retention-days: 30
|