summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucasFA <23667494+LucasFA@users.noreply.github.com>2024-02-12 01:26:36 +0100
committerGitHub <noreply@github.com>2024-02-11 19:26:36 -0500
commit2735fcea1b6580bc84137dc502412e61751715ac (patch)
treedf5b7f13c301e03e1a5df180f74e0e71d205c71c
parent25b5f2e305c8a830e7fb51b6872d6b52e752505a (diff)
Update CD workflows to use use `cross` (#101)HEADmain
* Update CD workflows to use use `cross` * build: local cross compilation With the intention of migrating gh action to native solution with cross Supported targets: aarch-64-linux-gnu, armv7-unknown-linux-gnueabihf Use cross build --target (target) Note: docker base images have been updated. See related documentation: https://github.com/cross-rs/cross/wiki/FAQ#custom-images * build(cd): use cross for CD Update container images along with it. Also a couple actions. Use action-rs/cargo only for the built in support. It is the documented gh actions way in the cross README. Manually would probably increase times significantly. See https://github.com/aome510/spotify-player/pull/343 --------- Co-authored-by: Thang Pham <phamducthang1234@gmail.com>
-rw-r--r--.github/workflows/cd.yml30
-rw-r--r--Cross.toml11
-rw-r--r--ci/Dockerfile-cross7
-rw-r--r--hackernews_tui/src/parser/mod.rs2
4 files changed, 26 insertions, 24 deletions
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml
index 31ef76f..641c9cb 100644
--- a/.github/workflows/cd.yml
+++ b/.github/workflows/cd.yml
@@ -21,20 +21,13 @@ jobs:
target: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- container: rust
- dependencies: "libssl-dev libasound2-dev libdbus-1-dev"
+ dependencies: "libssl-dev"
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- container: rustembedded/cross:aarch64-unknown-linux-gnu
- cross_arch: "arm64"
- pkg_config_path: "/usr/lib/aarch64-linux-gnu/pkgconfig/"
- dependencies: "libssl-dev:arm64 libasound2-dev:arm64 libdbus-1-dev:arm64"
+ cross_arch: true
- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
- cross_arch: "armhf"
- pkg_config_path: "/usr/lib/arm-linux-gnueabihf/pkgconfig/"
- container: rustembedded/cross:armv7-unknown-linux-gnueabihf
- dependencies: "libssl-dev:armhf libasound2-dev:armhf libdbus-1-dev:armhf"
+ cross_arch: true
- os: windows-latest
target: x86_64-pc-windows-msvc
@@ -42,28 +35,19 @@ jobs:
- name: Checkout source
uses: actions/checkout@v2
- - name: Set up cross compilation
- if: matrix.cross_arch
- run: |
- dpkg --add-architecture ${{ matrix.cross_arch }}
- echo "PKG_CONFIG_PATH=${{ matrix.pkg_config_path }}" >> $GITHUB_ENV
- echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
-
- name: Install Linux dependencies
if: matrix.dependencies
- run: apt update && apt install -y ${{ matrix.dependencies }}
+ run: sudo apt-get update && sudo apt-get install -y ${{ matrix.dependencies }}
- name: Install Rust toolchain
- uses: actions-rs/toolchain@v1
+ uses: dtolnay/rust-toolchain@stable
with:
- toolchain: stable
- override: true
- profile: minimal
- target: ${{ matrix.target }}
+ targets: ${{ matrix.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
+ use-cross: ${{ matrix.cross_arch }}
command: build
args: --locked --release --target ${{ matrix.target }}
diff --git a/Cross.toml b/Cross.toml
new file mode 100644
index 0000000..0a91b8c
--- /dev/null
+++ b/Cross.toml
@@ -0,0 +1,11 @@
+[build.env]
+passthrough = [
+ "CROSS_DEBUG",
+ "RUST_BACKTRACE",
+]
+
+[target.aarch64-unknown-linux-gnu]
+dockerfile = "./ci/Dockerfile-cross"
+
+[target.armv7-unknown-linux-gnueabihf]
+dockerfile = "./ci/Dockerfile-cross"
diff --git a/ci/Dockerfile-cross b/ci/Dockerfile-cross
new file mode 100644
index 0000000..515d3a0
--- /dev/null
+++ b/ci/Dockerfile-cross
@@ -0,0 +1,7 @@
+ARG CROSS_BASE_IMAGE
+FROM $CROSS_BASE_IMAGE
+
+ARG CROSS_DEB_ARCH
+RUN dpkg --add-architecture $CROSS_DEB_ARCH && \
+ apt-get update && \
+ apt-get install -y libssl-dev:$CROSS_DEB_ARCH
diff --git a/hackernews_tui/src/parser/mod.rs b/hackernews_tui/src/parser/mod.rs
index 4dbc874..1f0e5c5 100644
--- a/hackernews_tui/src/parser/mod.rs
+++ b/hackernews_tui/src/parser/mod.rs
@@ -2,4 +2,4 @@ mod article;
mod html;
mod rcdom;
-pub use {article::*, html::*};
+pub use html::*;