Update deps #1262
Workflow file for this run
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
on: | |
pull_request: | |
push: | |
branches: [main] | |
tags: ["v*"] | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_NET_RETRY: 10 | |
RUST_BACKTRACE: short | |
RUSTFLAGS: "-D warnings" | |
RUSTUP_MAX_RETRIES: 10 | |
name: ci | |
jobs: | |
hygiene: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Setup | Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Setup | Checkout | |
uses: actions/checkout@v3 | |
- name: Setup | Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: clippy, rustfmt | |
- name: Setup | Tools | |
run: sudo apt-get install -y protobuf-compiler libtss2-dev | |
- name: Setup | Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Build | Hygiene | |
run: | | |
cargo fmt -- --check | |
cargo clippy --all-features -- -D clippy::all | |
- name: Build | Test | |
run: | | |
cargo test | |
build: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
target: | |
- arm-unknown-linux-gnueabihf | |
- armv5te-unknown-linux-musleabi | |
- armv7-unknown-linux-musleabihf | |
- aarch64-unknown-linux-musl | |
- mips-unknown-linux-musl | |
- mipsel-unknown-linux-musl | |
- x86_64-unknown-debian-gnu | |
- x86_64-tpm-debian-gnu | |
steps: | |
- name: Setup | Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Setup | Checkout | |
uses: actions/checkout@v3 | |
- name: Setup | Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Setup | Tools | |
uses: davidB/rust-cargo-make@v1 | |
- name: Setup | Cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: ${{ matrix.target }} | |
- name: Setup | Cross | |
uses: jaxxstorm/[email protected] | |
env: | |
## Allow cross install into PATH | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
repo: rust-embedded/cross | |
- name: Build | Compile | |
run: cargo make --profile ${{ matrix.target }} build | |
- name: Buld | Package | |
run: cargo make --profile ${{ matrix.target }} pkg | |
- name: Build | Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: helium-gateway-${{ matrix.target }} | |
if-no-files-found: error | |
path: helium-gateway-*.tar.gz | |
release: | |
if: startsWith(github.ref, 'refs/tags') | |
needs: [hygiene, build] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Setup | Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Setup | Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: helium-gateway-*.tar.gz | |
- name: Release | Artifacts | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
fail_on_unmatched_files: true | |
files: | | |
**/helium-gateway-*.tar.gz | |
name: ${{github.ref_name}} | |
docker_buildx: | |
# Ensure we don't publish images until we pass clippy. | |
needs: [hygiene] | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Setup | Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Setup | Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup | Docker | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Setup | Quay.io | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_MINER_USER }} | |
password: ${{ secrets.QUAY_MINER_UPLOAD_TOKEN }} | |
- name: Setup | Image Tag | |
if: github.event_name == 'pull_request' | |
run: echo "image_tag=PR${{ github.event.pull_request.number }}-$(git rev-parse --short ${{ github.event.pull_request.head.sha }})" >> $GITHUB_ENV | |
- name: Setup | Image Tag | |
if: github.event_name != 'pull_request' | |
run: echo "image_tag=$(git describe)" >> $GITHUB_ENV | |
# We publish all builds to the test-images repo. | |
- name: Build | Test Image | |
uses: docker/build-push-action@v3 | |
env: | |
# The attestation manifests cause build errors for some makers. | |
# See https://github.com/helium/gateway-rs/issues/409 | |
BUILDX_NO_DEFAULT_ATTESTATIONS: 1 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
labels: VERSION=${{ env.image_tag }} | |
tags: quay.io/team-helium/test-images:gateway-${{ env.image_tag }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# Publish to miner quay-repo on release only. | |
- name: Build | Release Image | |
if: startsWith(github.ref, 'refs/tags') | |
uses: docker/build-push-action@v3 | |
env: | |
# The attestation manifests cause build errors for some makers. | |
# See https://github.com/helium/gateway-rs/issues/409 | |
BUILDX_NO_DEFAULT_ATTESTATIONS: 1 | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
labels: VERSION=${{ github.ref_name }} | |
tags: | | |
quay.io/team-helium/miner:gateway-${{ github.ref_name }} | |
quay.io/team-helium/miner:gateway-latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |