mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 13:38:43 +00:00
132 lines
4.3 KiB
YAML
132 lines
4.3 KiB
YAML
name: Rust
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
tags: [ 'v*' ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
continue-on-error: ${{ matrix.experimental }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- target: x86_64-unknown-linux-gnu
|
|
os: ubuntu-latest
|
|
output: cargo-binstall
|
|
experimental: false
|
|
- target: x86_64-apple-darwin
|
|
os: macos-latest
|
|
output: cargo-binstall
|
|
experimental: false
|
|
- target: armv7-unknown-linux-gnueabihf
|
|
os: ubuntu-20.04
|
|
output: cargo-binstall
|
|
experimental: true
|
|
- target: x86_64-pc-windows-msvc
|
|
os: windows-latest
|
|
output: cargo-binstall.exe
|
|
experimental: true
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: FranzDiebold/github-env-vars-action@v1.2.1
|
|
|
|
- name: Configure toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: nightly
|
|
target: ${{ matrix.target }}
|
|
override: true
|
|
|
|
- name: Configure caching
|
|
uses: actions/cache@v2
|
|
# Caching disabled on macos due to https://github.com/actions/cache/issues/403
|
|
if: ${{ matrix.os != 'macos-latest' }}
|
|
with:
|
|
key: ${{ matrix.os }}-${{ matrix.target }}
|
|
path: |
|
|
${{ env.HOME }}/.cargo"
|
|
target
|
|
|
|
- name: Install openssl (apt armv7)
|
|
if: ${{ matrix.os == 'ubuntu-20.04' && matrix.target == 'armv7-unknown-linux-gnueabihf' }}
|
|
run: |
|
|
cat /etc/apt/sources.list{,.d/*.list}
|
|
sudo sed -i'' -E 's/^deb http:\/\/(azure.archive|security).ubuntu.com/deb [arch=amd64,i386] http:\/\/\1.ubuntu.com/' /etc/apt/sources.list
|
|
sudo sed -i'' -E 's/^deb http:\/\/(azure.archive|security).ubuntu.com/deb [arch=amd64,i386] http:\/\/\1.ubuntu.com/' /etc/apt/sources.list.d/*.list
|
|
sudo dpkg --add-architecture armhf
|
|
cat /etc/apt/sources.list{,.d/*.list}
|
|
sudo apt-get update
|
|
sudo apt-get install -y libssl-dev:armhf libssl1.1:armgf zlib1g-dev:armhf zlib1g:armhf libc-dev:armhf
|
|
echo "PKG_CONFIG_ALLOW_CROSS=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
|
|
|
|
- name: Install openssl (vcpkg)
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
timeout-minutes: 30
|
|
run: |
|
|
vcpkg integrate install
|
|
vcpkg install openssl:x64-windows-static
|
|
echo "OPENSSL_DIR=C:/vcpkg/installed/x64-windows-static/" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
|
|
echo "OPENSSL_ROOT_DIR=C:/vcpkg/installed/x64-windows-static/" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
|
|
echo "OPENSSL_STATIC=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
|
|
|
|
- name: Cache vcpkg
|
|
if: ${{ matrix.os == 'windows-latest' }}
|
|
uses: actions/cache@v2
|
|
with:
|
|
key: ${{ matrix.os }}-${{ matrix.target }}
|
|
path: C:/vcpkg/installed
|
|
|
|
- name: Build release
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: --target ${{ matrix.target }} --release
|
|
|
|
- name: Copy / Rename utility
|
|
run: |
|
|
cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }}
|
|
tar -czvf cargo-binstall-${{ matrix.target }}.tgz ${{ matrix.output }}
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: cargo-binstall-${{ matrix.target }}.tgz
|
|
path: cargo-binstall-${{ matrix.target }}.tgz
|
|
|
|
- name: Upload binary to release
|
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
file: cargo-binstall-${{ matrix.target }}.tgz
|
|
asset_name: cargo-binstall-${{ matrix.target }}.tgz
|
|
tag: ${{ github.ref }}
|
|
overwrite: true
|
|
|
|
release:
|
|
name: Upload firmware artifacts to release
|
|
runs-on: ubuntu-latest
|
|
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
|
steps:
|
|
|
|
- name: Create Release
|
|
uses: actions/create-release@v1
|
|
id: create_release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: Release ${{ github.ref }}
|
|
body: Release ${{ github.ref }}
|
|
|