This repository has been archived by the owner on Jan 9, 2024. It is now read-only.
Use Config.cmake for dependencies #356
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: "g" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- '**' | |
env: | |
ccache_basedir: ${{ github.workspace }} | |
ccache_dir: "${{ github.workspace }}/.ccache" | |
ccache_compilercheck: content | |
ccache_compress: 'true' | |
ccache_compresslevel: 9 | |
ccache_maxsize: 200M | |
ccache_cmake: -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache | |
jobs: | |
main: | |
name: "build-test" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install Dependencies | |
run: |- | |
sudo apt-get update | |
sudo apt-get install -y \ | |
ccache libprotobuf-dev protobuf-compiler \ | |
libibus-1.0-dev \ | |
qttools5-dev qtbase5-dev \ | |
- name: Generate ccache_vars for ccache based on machine | |
shell: bash | |
id: ccache_vars | |
run: |- | |
echo "::set-output name=hash::$(echo ${{ env.ccache_compilercheck }})" | |
echo "::set-output name=timestamp::$(date '+%Y-%m-%dT%H.%M.%S')" | |
- name: Cache-op for build-cache through ccache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.ccache_dir }} | |
key: ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }}-${{ steps.ccache_vars.outputs.timestamp }} | |
restore-keys: |- | |
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }}-${{ github.ref }} | |
ccache-${{ matrix.identifier }}-${{ steps.ccache_vars.outputs.hash }} | |
ccache-${{ matrix.identifier }} | |
- name: ccache environment setup | |
run: |- | |
echo "CCACHE_COMPILER_CHECK=${{ env.ccache_compilercheck }}" >> $GITHUB_ENV | |
echo "CCACHE_BASEDIR=${{ env.ccache_basedir }}" >> $GITHUB_ENV | |
echo "CCACHE_COMPRESS=${{ env.ccache_compress }}" >> $GITHUB_ENV | |
echo "CCACHE_COMPRESSLEVEL=${{ env.ccache_compresslevel }}" >> $GITHUB_ENV | |
echo "CCACHE_DIR=${{ env.ccache_dir }}" >> $GITHUB_ENV | |
echo "CCACHE_MAXSIZE=${{ env.ccache_maxsize }}" >> $GITHUB_ENV | |
- name: ccache prolog | |
run: |- | |
ccache -s # Print current cache stats | |
ccache -z # Zero cache entry | |
- name: cmake | |
run: |- | |
mkdir -p build | |
cd build | |
cmake -L .. -DCOMPILE_TESTS=on ${{ env.ccache_cmake }} | |
- name: Build from source | |
working-directory: build | |
run: | | |
make -j2 | |
- name: Test translator backend | |
working-directory: build/lemonade | |
run: |- | |
# Install bergamot, which will manage models. | |
python3 -m pip install bergamot -f https://github.com/jerinphilip/bergamot-translator/releases/expanded_assets/latest | |
# Download models. | |
bergamot download -m en-fr-tiny | |
bergamot download -m fr-en-tiny | |
bergamot download -m de-en-tiny | |
bergamot download -m en-de-tiny | |
./test fake < ${{ github.workspace }}/data/samples.txt | |
./test real < ${{ github.workspace }}/data/samples.txt | |
- name: ccache epilog | |
run: 'ccache -s # Print current cache stats' |