Skip to content

Commit

Permalink
Add github actions pipeline (#5)
Browse files Browse the repository at this point in the history
* Add github actions pipeline

- Update `Cargo.toml`
- Add LICENSE
- Add `release.yaml`
- Use `lzma-rs` crate with feature `static`

Co-authored-by: Ajeet D'Souza <98ajeet@gmail.com>
  • Loading branch information
crazystylus and ajeetdsouza committed Apr 8, 2023
1 parent 2733a35 commit a973004
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 4 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: release
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
env:
CARGO_INCREMENTAL: 0
permissions:
contents: write

jobs:
release:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
# - os: ubuntu-latest
# target: arm-unknown-linux-gnueabihf
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu

- os: macos-11
target: x86_64-apple-darwin
# - os: macos-11
# target: aarch64-apple-darwin

# - os: windows-latest
# target: x86_64-pc-windows-msvc
# - os: windows-latest
# target: aarch64-pc-windows-msvc
steps:
- name: Checkout repository
uses: actions/checkout@dc323e67f16fb5f7663d20ff7941f27f5809e9b6 # v2.6.0
with:
fetch-depth: 0

- name: Get version
id: get_version
uses: SebRollen/toml-action@2bd04b06a3ebc3e6a3eb6060de115710cad16cd6 # v1.0.2
with:
file: Cargo.toml
field: package.version

- name: Install Rust
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.target }}

- name: Setup cache
uses: Swatinem/rust-cache@81d053bdb0871dcd3f10763c8cc60d0adc41762b # v1
with:
key: ${{ matrix.target }}

- name: Install build deps for macos
if: runner.os == 'macOS'
run: brew install xz protobuf

- name: Build binary
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: build
args: --release --locked --target=${{ matrix.target }} --color=always --verbose
use-cross: ${{ runner.os == 'Linux' }}

- name: Package for (*nix)
if: runner.os != 'Windows'
run: >
tar -cv
LICENSE README.md
-C ../
-C target/${{ matrix.target }}/release/ otadump
| gzip --best
> 'otadump-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.tar.gz'
- name: Package (Windows)
if: runner.os == 'Windows'
run: >
7z a 'otadump-${{ steps.get_version.outputs.value }}-${{ matrix.target }}.zip'
LICENSE README.md
./man/
./contrib/completions/
./target/${{ matrix.target }}/release/otadump.exe
- name: Upload artifact
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1
with:
name: ${{ matrix.target }}
path: |
*.deb
*.tar.gz
*.zip
- name: Create release
if: ${{ github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, 'chore(release)') }}
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
with:
draft: true
files: |
*.deb
*.tar.gz
*.zip
name: ${{ steps.get_version.outputs.value }}
tag_name: ""
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
[package]
authors = [
"Kartik Sharma <kartik.sharma522@gmail.com>",
"Ajeet D'Souza <98ajeet@gmail.com>",
]
description = "Android OTA payload dumper"
categories = ["command-line-utilities", "android"]
edition = "2021"
keywords = ["android", "cli", "terminal"]
license = "MIT"
name = "otadump"
repository = "https://github.com/crazystylus/otadump"
readme = "README.md"
rust-version = "1.68.0"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -17,7 +28,7 @@ nom = "7.1.3"
nom-derive = "0.10.1"
prost = "0.11.8"
rayon = "1.7.0"
rust-lzma = "0.5.1"
rust-lzma = { git = "https://github.com/crazystylus/rust-lzma", branch = "feat-static-linking", version = "0.5.1", features = ["static"] }
sha2 = "0.10.6"
sync-unsafe-cell = "0.1.0"

Expand All @@ -26,4 +37,6 @@ prost-build = "0.11"

[profile.release]
codegen-units = 1
debug = 0
lto = true
strip = true
15 changes: 15 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[target.x86_64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main"
pre-build = ["apt-get update", "apt install -y liblzma-dev protobuf-compiler"]

[target.aarch64-unknown-linux-gnu]
image = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main"
pre-build = ["dpkg --add-architecture arm64","apt-get update", "apt install -y liblzma-dev:arm64 protobuf-compiler"]

[target.arm-unknown-linux-gnueabihf]
image = "ghcr.io/cross-rs/arm-unknown-linux-gnueabihf:main"
pre-build = ["dpkg --add-architecture armhf","apt-get update", "apt install -y liblzma-dev:armhf protobuf-compiler"]

[target.armv7-unknown-linux-gnueabihf]
image = "ghcr.io/cross-rs/armv7-unknown-linux-gnueabihf:main"
pre-build = ["dpkg --add-architecture armhf","apt-get update", "apt install -y liblzma-dev:armhf protobuf-compiler"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Kartik Sharma, Ajeet D'Souza

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

0 comments on commit a973004

Please sign in to comment.