Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CD workflows to use use cross #101

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 7 additions & 23 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,33 @@ 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

steps:
- 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 }}

Expand Down
11 changes: 11 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -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"
7 changes: 7 additions & 0 deletions ci/Dockerfile-cross
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion hackernews_tui/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ mod article;
mod html;
mod rcdom;

pub use {article::*, html::*};
pub use html::*;
Loading