Skip to content

main.rs: fix non-portable assumpton about c_char signedness. #99

main.rs: fix non-portable assumpton about c_char signedness.

main.rs: fix non-portable assumpton about c_char signedness. #99

Workflow file for this run

name: Tests
env:
RUST_BACKTRACE: 1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
on:
workflow_dispatch:
push:
branches:
- '**'
paths:
- 'src/**'
- 'tests/**'
- 'Cargo.lock'
- 'Cargo.toml'
jobs:
test:
name: Test on ${{ matrix.build }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
build: [linux-amd64, macos-x86_64] #, linux-aarch64, macos-arm64]
include:
- build: linux-amd64
os: ubuntu-latest
rust: stable
artifact_name: 'gerb-linux-amd64'
target: x86_64-unknown-linux-gnu
- build: macos-x86_64
os: macos-latest
rust: stable
target: x86_64-apple-darwin
artifact_name: 'gerb-darwin-amd64'
#- build: linux-aarch64
# os: ubuntu-latest
# rust: stable
# target: aarch64-unknown-linux-gnu
# artifact_name: 'gerb-linux-aarch64'
#- build: macos-arm64
# os: macos-latest
# rust: stable
# target: aarch64-apple-darwin
# artifact_name: 'gerb-darwin-arm64'
steps:
- uses: actions/checkout@v2
- id: cache-rustup
name: Cache Rust toolchain
uses: actions/cache@v3
with:
path: ~/.rustup
key: toolchain-${{ matrix.os }}-${{ matrix.rust }}
- if: ${{ steps.cache-rustup.outputs.cache-hit != 'true' }}
name: Install Rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
components: clippy, rustfmt
target: ${{ matrix.target }}
override: true
- name: Configure cargo data directory
# After this point, all cargo registry and crate data is stored in
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
# that are needed during the build process. Additionally, this works
# around a bug in the 'cache' action that causes directories outside of
# the workspace dir to be saved/restored incorrectly.
run: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
- id: cache-cargo
name: Cache cargo configuration and installations
uses: actions/cache@v3
with:
path: ${{ env.CARGO_HOME }}
key: cargo-${{ matrix.os }}-${{ matrix.rust }}
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
name: Setup Rust target
run: |
mkdir -p "${{ env.CARGO_HOME }}"
cat << EOF > "${{ env.CARGO_HOME }}"/config.toml
[build]
target = "${{ matrix.target }}"
EOF
- if: ${{ steps.cache-cargo.outputs.cache-hit != 'true' }} && matrix.target
name: Add lint dependencies
run: |
cargo install --target "${{ matrix.target }}" cargo-sort
- name: Install dependencies (macos x86_64)
if: matrix.os == 'macos-latest' && matrix.target == 'x86_64-apple-darwin'
shell: bash
run: |
set -ex
brew install librsvg gtk+3 gnome-icon-theme
- name: Install dependencies (macos arm64)
if: matrix.os == 'macos-latest' && matrix.target == 'aarch64-apple-darwin'
shell: bash
run: |
set -ex
#arch -arm64e bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
#arch -arm64e brew install librsvg gtk+3 gnome-icon-theme
#brew fetch --force --deps --bottle-tag=arm64_big_sur librsvg gtk+3 gnome-icon-theme | tee brew.out
#for t in `grep "Downloaded to" < brew.out | cut -f 3 -d ' '`; do
# brew install "$t"
#done
- name: Install dependencies (linux)
if: matrix.os == 'ubuntu-latest'
run: |
set -ex
sudo apt install libgtk-3-dev
- name: Cargo check
run: |
make feature-check
- name: Cargo test
if: success() || failure() # always run even if other steps fail, except when cancelled <https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f>
run: |
cargo test