reverting some files to origin version #135
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ master] | |
tags: [ 'v*' ] | |
pull_request: | |
branches: [ master ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-util: | |
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: sx127x-util | |
use_cross: false | |
experimental: false | |
args: --features util,driver-pal/hal-cp2130,driver-pal/hal-linux | |
# probably want next three targets on master, but they are time consuming when testing examples | |
- target: armv7-unknown-linux-gnueabihf | |
os: ubuntu-latest | |
output: sx127x-util | |
use_cross: true | |
experimental: true | |
args: --features util,driver-pal/hal-cp2130,driver-pal/hal-linux | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
output: sx127x-util | |
use_cross: false | |
experimental: false | |
args: --no-default-features --features util,driver-pal/hal-cp2130 | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
output: sx127x-util.exe | |
use_cross: false | |
experimental: true | |
args: --no-default-features --features util,driver-pal/hal-cp2130 | |
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 | |
with: | |
key: ${{ matrix.os }}-${{ matrix.target }} | |
path: | | |
${{ env.HOME }}/.cargo" | |
target | |
- name: Install libusb (brew) | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: brew install libusb | |
- name: Install libusb (apt native) | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64-unknown-linux-gnu' }} | |
run: sudo apt install -y libusb-1.0-0-dev | |
- name: Install libusb (apt armv7) | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.target == 'armv7-unknown-linux-gnueabihf' }} | |
uses: ryankurte/action-apt@v0.3.0 | |
with: | |
arch: armhf | |
packages: libusb-1.0-0-dev:armhf | |
- name: Install libusb (vcpkg) | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
vcpkg integrate install | |
vcpkg install libusb:x64-windows-static | |
echo "LIBUSB_DIR=C:/vcpkg/installed/x64-windows-static/" | 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: $VCPKG_DIRECTORY | |
# probably want next 4 name sections on master, but not on forks and branches | |
- name: Build release | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.use_cross }} | |
command: build | |
args: --target ${{ matrix.target }} --release ${{ matrix.args }} | |
- name: Copy / Rename utility | |
run: | | |
cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }}-${{ matrix.target }} | |
tar -czvf sx127x-util-${{ matrix.target }}.tgz ${{ matrix.output }}-${{ matrix.target }} | |
- name: Upload utility artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ matrix.output }}-${{ matrix.target }} | |
path: ${{ matrix.output }}-${{ matrix.target }} | |
- name: Upload utility binary to release | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: sx127x-util-${{ matrix.target }}.tgz | |
asset_name: sx127x-util-${{ matrix.target }}.tgz | |
tag: ${{ github.ref }} | |
overwrite: true | |
test_examples: | |
name: Test examples | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
strategy: | |
matrix: | |
mcu: [stm32f103, stm32f411 ] | |
include: | |
- mcu: stm32f103 | |
hal: "stm32f1xx" | |
trg: "thumbv7m-none-eabi" | |
- mcu: stm32f411 | |
hal: "stm32f4xx" | |
trg: "thumbv7em-none-eabihf" | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
#- name: Build | |
# uses: actions-rs/cargo@v1 | |
# with: | |
# command: build | |
# args: --no-default-features --release --target ${{ matrix.trg }} --features ${{ matrix.mcu }},compat | |
- name: Build example lora_spi_send | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --no-default-features --release --target ${{ matrix.trg }} --features ${{ matrix.hal }},${{ matrix.mcu }},compat --example lora_spi_send | |
use-cross: true | |
- name: Build example lora_spi_receive | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --no-default-features --release --target ${{ matrix.trg }} --features ${{ matrix.hal }},${{ matrix.mcu }},compat --example lora_spi_receive | |
use-cross: true | |
- name: Build example lora_spi_gps | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --no-default-features --release --target ${{ matrix.trg }} --features ${{ matrix.hal }},${{ matrix.mcu }},compat --example lora_spi_gps | |
use-cross: true | |
# probably want release on master, but not on forks and branches | |
release: | |
name: Create 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 }} | |