Update dependencies-non-major #192
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: Build Image | |
on: | |
push: | |
branches: | |
- "main" | |
tags: | |
- "**" | |
pull_request: | |
branches: | |
- "**" | |
permissions: | |
contents: write | |
concurrency: | |
group: build | |
env: | |
CARGO_INCREMENTAL: 0 | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get sources | |
uses: actions/checkout@v3 | |
- name: Install Rust stable (x86_64) | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: x86_64-unknown-linux-musl | |
default: true | |
components: rustfmt, clippy | |
override: true | |
- name: Install Packages | |
run: sudo apt-get install --assume-yes --no-install-recommends musl-tools | |
- name: Set up a Rust-specific cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo | |
target | |
key: ${{ runner.os }}-${{ runner.arch }} }} | |
- name: Install cargo-readme | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: cargo-readme | |
- name: Check formatting of non-Rust code and Readme | |
run: | | |
export PATH="${PATH}:$(yarn global bin)" | |
yarn global add prettier | |
prettier --check . | |
- name: Check formatting of Rust code | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: -- --check | |
- name: Lint Readme | |
run: | | |
for dir in `ls -d1 */ | grep -v "target"`; do | |
(cd "${dir}" && cargo readme --output README.md) | |
done | |
if [[ -n "$(git status -s)" ]]; then echo "Seems like cargo readme wasn't executed"; exit 1; fi | |
- name: Lint | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
args: -- -D warnings | |
- name: Test | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
- name: Build (x86_64) | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target x86_64-unknown-linux-musl --release | |
- name: Build (Arm64) | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --target aarch64-unknown-linux-musl --release | |
use-cross: true | |
- name: Package zips | |
run: | | |
for toolchain in x86_64-unknown-linux-musl aarch64-unknown-linux-musl; do | |
ARCH=$(echo "${toolchain}" | cut -f1 -d-) | |
for dir in `ls -d1 */ | grep -v "target" | grep -v "aarch64-linux-musl-cross"`; do | |
NAME=${dir%/} | |
cp "./target/${toolchain}/release/${NAME}" bootstrap | |
cp "${NAME}/README.md" README.md | |
zip "${NAME}-${ARCH}.zip" bootstrap LICENSE-APACHE LICENSE-MIT README.md | |
done | |
done | |
- name: Upload zips if not running on tag | |
uses: actions/upload-artifact@v3 | |
if: ${{ !startsWith(github.ref , 'refs/tags/') }} | |
with: | |
name: lambdas | |
path: "*.zip" | |
- name: Add artificats to release if on tag | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: "*.zip" |