Skip to content

Commit

Permalink
Add Linux with musl, Linux on aarch64, and macOS on aarch64 targets
Browse files Browse the repository at this point in the history
Use cross to cross-compile from Ubuntu to these platforms.

This will resolve #357 and #368 when the next release goes out.
  • Loading branch information
Wilfred committed Aug 24, 2023
1 parent c6008c2 commit fa20bd9
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 61 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/coverage.yml

This file was deleted.

18 changes: 10 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,31 @@ jobs:
strategy:
matrix:
include:
# - target: aarch64-unknown-linux-gnu
# os: ubuntu-20.04
# - target: aarch64-apple-darwin
# os: macos-latest
# Targets that match the OS of the runner.
- target: x86_64-unknown-linux-gnu
os: ubuntu-20.04
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest

# Targets using cross-compilation (upload-rust-binary-action
# detects that they need cross).
- target: x86_64-unknown-linux-musl
os: ubuntu-20.04
- target: aarch64-unknown-linux-gnu
os: ubuntu-20.04
- target: aarch64-apple-darwin
os: ubuntu-20.04
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: difft
# (optional) On which platform to distribute the `.tar.gz` file.
# [default value: unix]
# [possible values: all, unix, windows, none]
tar: unix
# (optional) On which platform to distribute the `.zip` file.
# [default value: windows]
# [possible values: all, unix, windows, none]
zip: windows
# (optional) Target triple, default is host triple.
target: ${{ matrix.target }}
Expand Down
74 changes: 43 additions & 31 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,53 @@ on: [push, pull_request]
name: Continuous integration

jobs:
test_linux:
name: Test Linux
build:
name: Test ${{ matrix.job.target }}
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 }
- { target: x86_64-apple-darwin, os: macos-latest }
- { target: x86_64-pc-windows-gnu, os: windows-latest }
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, use-cross: true }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, use-cross: true }
- { target: aarch64-apple-darwin, os: ubuntu-20.04, use-cross: true }
env:
BUILD_CMD: cargo

steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Install Rust toolchain
uses: dtolnay/[email protected]
with:
targets: ${{ matrix.job.target }}

- name: Install cross
if: matrix.job.use-cross
uses: taiki-e/install-action@v2
with:
tool: cross

- name: Overwrite build command env variable
if: matrix.job.use-cross
shell: bash
run: echo "BUILD_CMD=cross" >> $GITHUB_ENV

- name: Test
shell: bash
run: $BUILD_CMD test

test_mime_db:
name: Test with MIME database
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/[email protected]
- run: cargo test
# This also runs tests that rely on the MIME database being
# present.
# This runs tests that rely on the MIME database being present.
- run: cargo test -- --ignored

test_linux_latest_stable:
Expand All @@ -22,32 +60,6 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- run: cargo +stable test

# test_linux_arm64:
# name: Test Linux arm64 (build only)
# runs-on: ubuntu-20.04
# steps:
# - uses: actions/checkout@v3
# - uses: dtolnay/[email protected]
# - run: rustup target add aarch64-unknown-linux-gnu
# - run: sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
# - run: cargo build --target=aarch64-unknown-linux-gnu

test_mac:
name: Test macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/[email protected]
- run: cargo test

test_windows:
name: Test Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/[email protected]
- run: cargo test

regression_test:
name: Output Regression Test
runs-on: ubuntu-20.04
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ you to set DFT_UNSTABLE. The JSON structure may change in future.

Please give it a try and give feedback on GitHub issues.

### Build

Added support for Linux with musl, Linux on aarch64, and macOS on
aarch64.

Note that Difftastic already worked on these platforms, but they are
now exercised in CI and will be included in prebuilt binaries in
releases.

## 0.50 (released 15th August 2023)

### Conflicts
Expand Down

0 comments on commit fa20bd9

Please sign in to comment.