Skip to content

wip: fonts and status bar #165

wip: fonts and status bar

wip: fonts and status bar #165

name: Cargo Build & Test
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build-and-test:
name: Build and test on linux
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository_owner }}/lukaj-test:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
strategy:
matrix:
toolchain:
- stable
- beta
- nightly
steps:
- uses: actions/checkout@v3
- run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
- if: matrix.toolchain == 'stable'
run: |
rustup component add llvm-tools-preview
echo "RUSTFLAGS=-C instrument-coverage" >> $GITHUB_ENV
echo "LLVM_PROFILE_FILE=target/coverage/%p-%m.profraw" >> $GITHUB_ENV
- run: cargo build --features use-rsvg
- run: cargo test --features use-rsvg
- if: matrix.toolchain == 'stable'
run: |
grcov target/coverage --binary-path target/debug -s . -o target/tmp \
--keep-only "src/*" --keep-only "tests/*" --output-types lcov,markdown,html
cat target/tmp/markdown.md
- uses: actions/upload-artifact@v3
with:
name: artifacts-linux-${{ matrix.toolchain }}
path: target/tmp/*
retention-days: 7
if-no-files-found: error
- if: matrix.toolchain == 'stable' && github.ref == 'refs/heads/master'
uses: coverallsapp/github-action@v2
with:
files: target/tmp/lcov
format: lcov
github-token: ${{ secrets.GITHUB_TOKEN }}
build-and-test-win:
name: Build and test on windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
location: D:\
update: true
install : >-
mingw-w64-x86_64-gtk4
mingw-w64-x86_64-gettext
mingw-w64-x86_64-libxml2
mingw-w64-x86_64-pkgconf
mingw-w64-x86_64-gcc
mingw-w64-x86_64-SDL2
- run: rustup update stable-gnu && rustup default stable-gnu
- shell: bash
run: echo "D:/msys64/mingw64/bin" >> $GITHUB_PATH
- run: cargo build --features use-rsvg
- run: cargo test --features use-rsvg
- uses: actions/upload-artifact@v3
with:
name: artifacts-windows-gnu
path: target/tmp/*
retention-days: 7
if-no-files-found: error
# slightly modified version of ripgrep's 'create-release' workflow:
create-release:
name: create-release
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- name: Get the release version from the tag
if: env.VERSION == ''
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Show the version
run: |
echo "version is: $VERSION"
- name: Check that tag version and Cargo.toml version are the same
shell: bash
run: |
cargo_version=$(awk -F\" '/^version/ { print $2 }' Cargo.toml)
if ! [ "$VERSION" = "v$cargo_version" ]; then
echo "version does not match Cargo.toml" >&2
exit 1
fi
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create $VERSION --draft --verify-tag --title $VERSION
build-executables:
name: Build executables
runs-on: ${{ matrix.os }}
# note that we are not building with `user-rsvg` support here
# so using lukaj-test docker image with pre-installed dependencies
# is not required
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v3
- run: rustup update stable && rustup default stable
- name: Install dependencies
shell: bash
run: |
cargo install cargo-vcpkg
cargo vcpkg build
- name: Prepare environment variables
shell: bash
run: |
triplet=$(rustc -vV | awk '/^host/ { print $2 }')
version=$(awk -F\" '/^version/ { print $2 }' Cargo.toml)
name=lukaj-${version}-${triplet}
echo "NAME=$name" >> $GITHUB_ENV
echo "VERSION=$version" >> $GITHUB_ENV
- name: Build release binary
shell: bash
run: |
cargo build --verbose --features static-link --release
- name: Package release (Unix)
shell: bash
if: matrix.os != 'windows-latest'
run: |
asset=$NAME.tar.gz
tar -czvf $asset -C target/release lukaj
shasum -a 256 $asset > $asset.sha256
echo "ASSET=$asset" >> $GITHUB_ENV
- name: Package release (Windows)
shell: bash
if: matrix.os == 'windows-latest'
run: |
asset=$NAME.zip
cd target/release
7z a -tzip $asset lukaj.exe
cp $asset ../..
cd ../..
certutil -hashfile $asset SHA256 > $asset.sha256
echo "ASSET=$asset" >> $GITHUB_ENV
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
name: Upload release archive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
gh release upload v${{ env.VERSION }} ${{ env.ASSET }} ${{ env.ASSET }}.sha256
- uses: actions/upload-artifact@v3
with:
name: executables-${{ matrix.os }}
path: ${{ env.ASSET }}
retention-days: 7
if-no-files-found: error
publish:
name: Publish release
needs:
- create-release
- build-and-test
- build-and-test-win
- build-executables
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository_owner }}/lukaj-test:latest
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
steps:
- uses: actions/checkout@v3
- run: rustup update stable && rustup default stable
- run: cargo vcpkg build
- run: cargo publish --all-features --dry-run
- if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
name: Push to crates.io
run: cargo publish --all-features
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}