diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b460f3e3..54e7071e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: build: strategy: matrix: - target: [ x86_64-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc ] + target: [ x86_64-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc, armv7-unknown-linux-gnueabihf ] include: - target: x86_64-unknown-linux-gnu os: ubuntu-latest @@ -56,7 +56,15 @@ jobs: - uses: Swatinem/rust-cache@v1.2.0 + - name: Install compiler for armhf arch + if: matrix.target == 'armv7-unknown-linux-gnueabihf' + run: | + sudo apt-get update + sudo apt-get install gcc-arm-linux-gnueabihf + - name: Build binary + env: + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc run: | cargo build -p swap --target ${{ matrix.target }} @@ -77,7 +85,7 @@ jobs: RUST_TEST_TASKS: 2 strategy: matrix: - target: [ x86_64-unknown-linux-gnu, x86_64-apple-darwin ] + target: [ x86_64-unknown-linux-gnu, x86_64-apple-darwin, armv7-unknown-linux-gnueabihf ] include: - target: x86_64-unknown-linux-gnu os: ubuntu-latest @@ -91,7 +99,15 @@ jobs: - uses: Swatinem/rust-cache@v1.2.0 + - name: Install compiler for armhf arch + if: matrix.target == 'armv7-unknown-linux-gnueabihf' + run: | + sudo apt-get update + sudo apt-get install gcc-arm-linux-gnueabihf + - name: Build tests + env: + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc run: cargo build --tests --workspace --all-features - name: Run monero-harness tests diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index ccccae45..0501e090 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -1,4 +1,4 @@ -name: "Release swap" +name: "Release swap and asb" on: release: @@ -10,13 +10,32 @@ jobs: strategy: matrix: include: - - target: x86_64-unknown-linux-gnu + - bin: swap + target: x86_64-unknown-linux-gnu os: ubuntu-latest archive_ext: tar - - target: x86_64-apple-darwin + - bin: swap + target: x86_64-apple-darwin os: macos-latest archive_ext: tar - - target: x86_64-pc-windows-msvc + - bin: swap + target: x86_64-pc-windows-msvc + os: windows-latest + archive_ext: zip + - bin: asb + target: x86_64-unknown-linux-gnu + os: ubuntu-latest + archive_ext: tar + - bin: asb + target: armv7-unknown-linux-gnueabihf + os: ubuntu-latest + archive_ext: tar + - bin: asb + target: x86_64-apple-darwin + os: macos-latest + archive_ext: tar + - bin: asb + target: x86_64-pc-windows-msvc os: windows-latest archive_ext: zip runs-on: ${{ matrix.os }} @@ -29,11 +48,20 @@ jobs: - uses: Swatinem/rust-cache@v1.2.0 - - name: Build ${{ matrix.target }} release binary - run: cargo build --target=${{ matrix.target }} --release --package swap --bin swap + - name: Install compiler for armhf arch + if: matrix.target == 'armv7-unknown-linux-gnueabihf' + run: | + sudo apt-get update + sudo apt-get install gcc-arm-linux-gnueabihf + + - name: Build ${{ matrix.target }} ${{ matrix.bin }} release binary + env: + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc + run: cargo build --target=${{ matrix.target }} --release --package swap --bin ${{ matrix.bin }} - name: Smoke test the binary - run: target/${{ matrix.target }}/release/swap --help + if: matrix.target != 'armv7-unknown-linux-gnueabihf' # armv7-unknown-linux-gnueabihf is only cross-compiled, no smoke test + run: target/${{ matrix.target }}/release/${{ matrix.bin }} --help # Remove once python 3 is the default - uses: actions/setup-python@v1 @@ -51,26 +79,26 @@ jobs: triple = "${{ matrix.target }}".split("-") arch = triple[0] - archive_name=f'swap_${{ github.event.release.tag_name }}_{os_info.system}_{arch}.${{ matrix.archive_ext }}' + archive_name=f'${{ matrix.bin }}_${{ github.event.release.tag_name }}_{os_info.system}_{arch}.${{ matrix.archive_ext }}' print(f'::set-output name=archive::{archive_name}') - name: Pack macos archive if: matrix.os == 'macos-latest' shell: bash - run: gtar -C ./target/${{ matrix.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} swap + run: gtar -C ./target/${{ matrix.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} ${{ matrix.bin }} - name: Pack linux archive if: matrix.os == 'ubuntu-latest' shell: bash - run: tar -C ./target/${{ matrix.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} swap + run: tar -C ./target/${{ matrix.target }}/release --create --file=${{ steps.create-archive-name.outputs.archive }} ${{ matrix.bin }} - name: Pack windows archive if: matrix.os == 'windows-latest' shell: bash run: | - cp target/${{ matrix.target }}/release/swap.exe ./swap.exe - 7z a -tzip ${{ steps.create-archive-name.outputs.archive }} ./swap.exe + cp target/${{ matrix.target }}/release/${{ matrix.bin }}.exe ./${{ matrix.bin }}.exe + 7z a -tzip ${{ steps.create-archive-name.outputs.archive }} ./${{ matrix.bin }}.exe - name: Upload archive uses: actions/upload-release-asset@v1 diff --git a/Cargo.lock b/Cargo.lock index b80a4c92..f6eb58bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2311,6 +2311,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" +[[package]] +name = "openssl-src" +version = "111.14.0+1.1.1j" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "055b569b5bd7e5462a1700f595c7c7d487691d73b5ce064176af7f9f0cbb80a9" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.60" @@ -2320,6 +2329,7 @@ dependencies = [ "autocfg 1.0.1", "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] @@ -3598,6 +3608,7 @@ dependencies = [ "monero", "monero-harness", "monero-rpc", + "openssl", "pem", "port_check", "prettytable-rs", diff --git a/rust-toolchain b/rust-toolchain index b431082c..6a154529 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,3 +1,4 @@ [toolchain] channel = "nightly-2021-01-31" components = ["rustfmt", "clippy"] +targets = ["armv7-unknown-linux-gnueabihf"] diff --git a/swap/Cargo.toml b/swap/Cargo.toml index 2b3d8f3b..df100647 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -31,6 +31,7 @@ libp2p-async-await = { git = "https://github.com/comit-network/rust-libp2p-async miniscript = { version = "5", features = ["serde"] } monero = { version = "0.10", features = ["serde_support"] } monero-rpc = { path = "../monero-rpc" } +openssl = { version = "0.10", features = ["vendored"] } pem = "0.8" prettytable-rs = "0.8" rand = "0.7"