Merge pull request #206 from niklasdewally/format #6
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: "Code Coverage Main (Generate)" | ||
on: | ||
push: | ||
branches: | ||
- main # run for pushes to the main branch | ||
workflow_dispatch: | ||
env: | ||
rust_release: nightly | ||
conjure_version: | ||
- 2.5.1 | ||
release_suffix: linux | ||
jobs: | ||
coverage: | ||
name: "Generate Code Coverage Reports" | ||
# only do coverage for ready PRs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v2 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin | ||
~/.cargo/registry/index | ||
~/.cargo/registry/cache | ||
~/.cargo/git/db | ||
target | ||
solvers/minion/vendor | ||
solvers/chuffed/vendor | ||
key: ${{ runner.os }}-${{ env.rust_release }}-${{ github.event.repository.updated_at }} | ||
restore-keys: ${{ runner.os }}-${{ env.rust_release }} | ||
- name: Install rust ${{ env.rust_release }} | ||
working-directory: ./solvers/minion | ||
run: rustup update ${{ env.rust_release }} && rustup default ${{ env.rust_release }} | ||
- name: Add conjure to PATH | ||
run: echo "${HOME}/.cargo/bin/conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers" >> ${GITHUB_PATH} | ||
- name: Install conjure | ||
run: | | ||
if [ "$(conjure --version | head -n2 | tail -n1)" == "Release version ${{ env.conjure_version }}" ]; then | ||
echo "Found conjure, not fetching again." | ||
else | ||
echo "Did not find conjure, fetching." | ||
pushd ~/.cargo/bin | ||
rm -rf conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers* | ||
wget https://github.com/conjure-cp/conjure/releases/download/v${{ env.conjure_version }}/conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers.zip | ||
unzip conjure-v${{ env.conjure_version }}-${{ env.release_suffix }}-with-solvers.zip | ||
popd | ||
fi | ||
conjure --version | ||
- name: Generate coverage reports | ||
working-directory: . | ||
run: | | ||
./tools/gen_coverage_all.sh | ||
- name: Move all html to correct folders for deployment | ||
run: | | ||
# put things both in the sha directory, and in main/ | ||
mkdir -p deploy/conjure-oxide | ||
mkdir -p deploy/minion | ||
mkdir -p deploy/chuffed | ||
cp -r conjure_oxide/coverage/html/* deploy/conjure-oxide | ||
cp -r solvers/minion/coverage/html/* deploy/minion | ||
cp -r solvers/chuffed/coverage/html/* deploy/chuffed | ||
- name: Copy coverage report to /main. | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
folder: ./deploy | ||
target-folder: "coverage/main" | ||
branch: gh-pages | ||
commit-message: "Actions: Update code coverage for main (${{ steps.sha.outputs.result }})" |