style: fix code formatting issues #34
This file contains hidden or 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 OpenKeyring CLI | |
| on: | |
| push: | |
| branches: [ master, develop ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ master, develop ] | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| # Build for macOS | |
| build-macos: | |
| name: Build macOS (Universal) | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: x86_64-apple-darwin,aarch64-apple-darwin | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/registry | |
| key: build-${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo index | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cargo/git | |
| key: build-${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Cache cargo build | |
| uses: actions/cache@v4 | |
| with: | |
| path: target | |
| key: build-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build for x86_64 | |
| run: | | |
| cargo build --target x86_64-apple-darwin --release --verbose | |
| - name: Build for aarch64 | |
| run: | | |
| cargo build --target aarch64-apple-darwin --release --verbose | |
| - name: Create universal binary | |
| run: | | |
| mkdir -p target/universal-apple-darwin-release | |
| lipo -create \ | |
| target/x86_64-apple-darwin/release/ok \ | |
| target/aarch64-apple-darwin/release/ok \ | |
| -output target/universal-apple-darwin-release/ok | |
| chmod +x target/universal-apple-darwin-release/ok | |
| - name: Strip binary | |
| run: strip -x target/universal-apple-darwin-release/ok | |
| - name: Upload macOS universal binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ok-macos-universal | |
| path: target/universal-apple-darwin-release/ok | |
| - name: Create archive | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| cd target/universal-apple-darwin-release | |
| tar czf ok-macos-universal.tar.gz ok | |
| mv ok-macos-universal.tar.gz ../../../ | |
| - name: Upload release asset | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: ok-macos-universal.tar.gz | |
| generate_release_notes: true | |
| # Build for Linux | |
| build-linux: | |
| name: Build Linux (x86_64) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: build-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build | |
| run: | | |
| cargo build --release --verbose | |
| - name: Strip binary | |
| run: strip target/release/ok | |
| - name: Upload Linux binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ok-linux-x86_64 | |
| path: target/release/ok | |
| - name: Create archive | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| cd target/release | |
| tar czf ok-linux-x86_64.tar.gz ok | |
| mv ok-linux-x86_64.tar.gz ../../../ | |
| - name: Upload release asset | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: ok-linux-x86_64.tar.gz | |
| generate_release_notes: true | |
| # Build for Linux ARM64 | |
| build-linux-arm64: | |
| name: Build Linux (ARM64) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-unknown-linux-gnu | |
| - name: Install cross compiler | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: build-${{ runner.os }}-cargo-arm64-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build | |
| run: | | |
| CC=aarch64-linux-gnu-gcc \ | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ | |
| cargo build --target aarch64-unknown-linux-gnu --release --verbose | |
| - name: Strip binary | |
| run: aarch64-linux-gnu-strip target/aarch64-unknown-linux-gnu/release/ok | |
| - name: Upload Linux ARM64 binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ok-linux-aarch64 | |
| path: target/aarch64-unknown-linux-gnu/release/ok | |
| - name: Create archive | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| cd target/aarch64-unknown-linux-gnu/release | |
| tar czf ok-linux-aarch64.tar.gz ok | |
| mv ok-linux-aarch64.tar.gz ../../../ | |
| - name: Upload release asset | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: ok-linux-aarch64.tar.gz | |
| generate_release_notes: true | |
| # Build for Windows | |
| build-windows: | |
| name: Build Windows (x86_64) | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: pwsh | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: build-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build | |
| run: | | |
| cargo build --release --verbose | |
| - name: Upload Windows binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ok-windows-x86_64 | |
| path: target/release/ok.exe | |
| - name: Create archive | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| Compress-Archive -Path target\release\ok.exe -DestinationPath ok-windows-x86_64.zip | |
| - name: Upload release asset | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: ok-windows-x86_64.zip | |
| generate_release_notes: true | |
| # Build for Windows ARM64 | |
| build-windows-arm64: | |
| name: Build Windows (ARM64) | |
| runs-on: windows-latest | |
| defaults: | |
| run: | |
| shell: pwsh | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: aarch64-pc-windows-msvc | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: build-${{ runner.os }}-cargo-arm64-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build | |
| run: | | |
| cargo build --target aarch64-pc-windows-msvc --release --verbose | |
| - name: Upload Windows ARM64 binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ok-windows-aarch64 | |
| path: target/aarch64-pc-windows-msvc/release/ok.exe | |
| - name: Create archive | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| Compress-Archive -Path target\aarch64-pc-windows-msvc\release\ok.exe -DestinationPath ok-windows-aarch64.zip | |
| - name: Upload release asset | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: ok-windows-aarch64.zip | |
| generate_release_notes: true | |