Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongoode committed Jul 6, 2024
1 parent c1c1535 commit af3369f
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 50 deletions.
13 changes: 13 additions & 0 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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 \
libgtk-3-dev:$CROSS_DEB_ARCH \
libssl-dev:$CROSS_DEB_ARCH \
libasound2-dev:$CROSS_DEB_ARCH \
libglib2.0-dev:$CROSS_DEB_ARCH

ENV PKG_CONFIG_ALLOW_CROSS=1
38 changes: 14 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ jobs:
include:
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
deps: libgtk-3-dev libssl-dev libasound2-dev
- os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
cross_arch: true
- os: macOS-latest
- os: windows-latest

Expand All @@ -48,37 +46,29 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
toolchain: 1.65.0 # Specify an older, stable toolchain

- name: Setup Cache
uses: Swatinem/rust-cache@v2

- name: Install Cross
if: runner.os == 'Linux'
run: cargo install cross

- name: Run Tests
run: cargo test
continue-on-error: true

- name: Install Linux dependencies
if: runner.os == 'Linux' && !matrix.cross_arch && matrix.deps
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.deps }}
- name: Setup cross-compilation environment
if: matrix.cross_arch
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig" >> $GITHUB_ENV
echo "HOSTNAME=github-runner" >> $GITHUB_ENV # Set HOSTNAME for cross
- name: Install cross
if: matrix.cross_arch
run: cargo install cross
- name: Build (Linux)
if: runner.os == 'Linux'
uses: clechasseur/rs-cargo@v2
with:
use-cross: true
command: build
args: --release --target ${{ matrix.target }}

- name: Build Release (Linux x86_64)
if: runner.os == 'Linux' && !matrix.cross_arch
Expand Down
7 changes: 0 additions & 7 deletions .pkg/LINUX/Dockerfile

This file was deleted.

5 changes: 4 additions & 1 deletion Cross.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[target.aarch64-unknown-linux-gnu]
dockerfile = "./.pkg/LINUX/Dockerfile"
dockerfile = ".docker/Dockerfile"

[target.x86_64-unknown-linux-gnu]
dockerfile = ".docker/Dockerfile"
22 changes: 4 additions & 18 deletions psst-gui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,8 @@ long_description = """
Small and efficient graphical music player for Spotify network.
"""

[package.metadata.cross.target.x86_64-unknown-linux-gnu]
pre-build = [
"""apt-get update && apt-get --assume-yes install \
libgtk-3-dev \
libssl-dev \
libasound2-dev \
libglib2.0-dev
"""
]
[target.aarch64-unknown-linux-gnu]
image = "psst-cross:latest"

[package.metadata.cross.target.aarch64-unknown-linux-gnu]
pre-build = [
"""apt-get update && apt-get --assume-yes install \
libgtk-3-dev:arm64 \
libssl-dev:arm64 \
libasound2-dev:arm64 \
libglib2.0-dev:arm64
"""
]
[target.x86_64-unknown-linux-gnu]
image = "psst-cross:latest"

0 comments on commit af3369f

Please sign in to comment.