diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..0c1c209f --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[target.armv7-unknown-linux-gnueabihf] +linker = "arm-linux-gnueabihf-gcc" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b460f3e3..85b798f1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,10 +40,11 @@ jobs: build: strategy: matrix: - target: [ x86_64-unknown-linux-gnu, x86_64-apple-darwin, x86_64-pc-windows-msvc ] include: - target: x86_64-unknown-linux-gnu os: ubuntu-latest + - target: armv7-unknown-linux-gnueabihf + os: ubuntu-latest - target: x86_64-apple-darwin os: macos-latest - target: x86_64-pc-windows-msvc @@ -56,6 +57,12 @@ 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 run: | cargo build -p swap --target ${{ matrix.target }} @@ -77,7 +84,6 @@ jobs: RUST_TEST_TASKS: 2 strategy: matrix: - target: [ x86_64-unknown-linux-gnu, x86_64-apple-darwin ] include: - target: x86_64-unknown-linux-gnu os: ubuntu-latest diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index ccccae45..5d349586 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,19 @@ 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 + + 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 +78,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..b363a990 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -682,22 +682,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" -[[package]] -name = "core-foundation" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" - [[package]] name = "cpuid-bool" version = "0.1.2" @@ -1102,21 +1086,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.0.0" @@ -2131,24 +2100,6 @@ dependencies = [ "unsigned-varint 0.6.0", ] -[[package]] -name = "native-tls" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - [[package]] name = "nb-connect" version = "1.0.2" @@ -2291,39 +2242,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "openssl" -version = "0.10.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70" -dependencies = [ - "bitflags", - "cfg-if 1.0.0", - "foreign-types", - "lazy_static", - "libc", - "openssl-sys", -] - -[[package]] -name = "openssl-probe" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" - -[[package]] -name = "openssl-sys" -version = "0.9.60" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6" -dependencies = [ - "autocfg 1.0.1", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "parity-multiaddr" version = "0.11.0" @@ -3091,16 +3009,6 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" -[[package]] -name = "schannel" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" -dependencies = [ - "lazy_static", - "winapi 0.3.9", -] - [[package]] name = "scopeguard" version = "1.1.0" @@ -3159,29 +3067,6 @@ dependencies = [ "subtle 2.4.0", ] -[[package]] -name = "security-framework" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "0.9.0" @@ -3863,16 +3748,6 @@ dependencies = [ "syn", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" -dependencies = [ - "native-tls", - "tokio", -] - [[package]] name = "tokio-rustls" version = "0.22.0" @@ -3911,17 +3786,19 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1a5f475f1b9d077ea1017ecbc60890fda8e54942d680ca0b1d2b47cfa2d861b" +checksum = "1e96bb520beab540ab664bd5a9cfeaa1fcd846fa68c830b42e2c8963071251d2" dependencies = [ "futures-util", "log", - "native-tls", "pin-project 1.0.4", + "rustls 0.19.0", "tokio", - "tokio-native-tls", + "tokio-rustls", "tungstenite", + "webpki", + "webpki-roots 0.21.0", ] [[package]] @@ -4033,9 +3910,9 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "tungstenite" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ada8297e8d70872fa9a551d93250a9f407beb9f37ef86494eb20012a2ff7c24" +checksum = "5fe8dada8c1a3aeca77d6b51a4f1314e0f4b8e438b7b1b71e3ddaca8080e4093" dependencies = [ "base64 0.13.0", "byteorder", @@ -4044,11 +3921,14 @@ dependencies = [ "httparse", "input_buffer", "log", - "native-tls", "rand 0.8.2", + "rustls 0.19.0", "sha-1", + "thiserror", "url", "utf-8", + "webpki", + "webpki-roots 0.21.0", ] [[package]] @@ -4180,12 +4060,6 @@ dependencies = [ "serde", ] -[[package]] -name = "vcpkg" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00bca6106a5e23f3eee943593759b7fcddb00554332e856d990c893966879fb" - [[package]] name = "vec-arena" version = "1.0.0" diff --git a/bors.toml b/bors.toml index 11761796..ea398644 100644 --- a/bors.toml +++ b/bors.toml @@ -1,10 +1,11 @@ status = [ "static_analysis", - "build (x86_64-unknown-linux-gnu)", - "build (x86_64-apple-darwin)", - "build (x86_64-pc-windows-msvc)", - "test (x86_64-unknown-linux-gnu)", - "test (x86_64-apple-darwin)", + "build (x86_64-unknown-linux-gnu, ubuntu-latest)", + "build (armv7-unknown-linux-gnueabihf, ubuntu-latest)", + "build (x86_64-apple-darwin, macos-latest)", + "build (x86_64-pc-windows-msvc, windows-latest)", + "test (x86_64-unknown-linux-gnu, ubuntu-latest)", + "test (x86_64-apple-darwin, macos-latest)", "docker_tests (happy_path)", "docker_tests (happy_path_restart_bob_before_comm)", "docker_tests (bob_refunds_using_cancel_and_refund_command)", 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..4795c765 100644 --- a/swap/Cargo.toml +++ b/swap/Cargo.toml @@ -48,7 +48,7 @@ strum = { version = "0.20", features = ["derive"] } thiserror = "1" time = "0.2" tokio = { version = "1.0", features = ["rt-multi-thread", "time", "macros", "sync", "process", "fs"] } -tokio-tungstenite = { version = "0.13", features = [ "tls" ] } +tokio-tungstenite = { version = "0.14", features = [ "rustls-tls" ] } tokio-util = { version = "0.6.3", features = ["io"] } toml = "0.5" tracing = { version = "0.1", features = ["attributes"] }