Add a readme #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cargo Build & Test | |
on: | |
pull_request: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build_and_test: | |
name: Rust project - latest | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
# - windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check format | |
run: cargo fmt --all --check | |
- name: Download libzim | |
run: | | |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]] | |
then | |
OS="linux" | |
ARCH="x86_64" | |
ARCH_POST="/x86_64-linux-gnu" | |
LIBZIM_NAME="libzim.so.9" | |
else | |
OS="macos" | |
ARCH="arm64" | |
ARCH_POST="" | |
LIBZIM_NAME="libzim.9.dylib" | |
fi | |
VERSION="9.2.1" | |
ARCHIVE_NAME="libzim_${OS}-${ARCH}-${VERSION}" | |
wget "https://download.openzim.org/release/libzim/${ARCHIVE_NAME}.tar.gz" | |
tar xf ${ARCHIVE_NAME}.tar.gz | |
ARCHIVE_PATH=$(pwd)/${ARCHIVE_NAME} | |
LIBZIM_LIB=${ARCHIVE_PATH}/lib${ARCH_POST} | |
echo "LIBZIM_NAME=$LIBZIM_NAME" >> $GITHUB_ENV | |
echo "LIBZIM_LIB=$LIBZIM_LIB" >> $GITHUB_ENV | |
echo "LIBZIM_INCLUDE=${ARCHIVE_PATH}/include" >> $GITHUB_ENV | |
echo "DYLD_LIBRARY_PATH=${LIBZIM_LIB}:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV | |
- name: Build | |
run: cargo build | |
- name: Test code | |
run: cargo test --verbose | |
- name: Prepare artefact dir | |
run: | | |
mkdir ARTEFACTS | |
cp target/debug/zim2waj ARTEFACTS | |
cp ${LIBZIM_LIB}/${LIBZIM_NAME} ARTEFACTS | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zim2waj-${{ matrix.os }} | |
path: | | |
ARTEFACTS/* | |
compression-level: 0 |