Skip to content

fixing change

fixing change #3

Workflow file for this run

name: CI
on:
push:
paths:
- 'cmake/projects/**'
- 'cmake/modules/**'
- 'cmake/schemes/**'
- 'cmake/templates/**'
- 'tests/**'
pull_request:
paths:
- 'cmake/projects/**'
- 'cmake/modules/**'
- 'cmake/schemes/**'
- 'cmake/templates/**'
- 'tests/**'
workflow_dispatch:
inputs:
project:
description: 'Project name'
required: true
jobs:
set_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Git checkout
uses: actions/[email protected]
- name: Manual dispatch, get project name from input
if: github.event_name == 'workflow_dispatch'
run: |
echo '["cmake/projects/${{ github.event.inputs.project }}/hunter.cmake"]' > ${HOME}/files.json
- name: Get changed files and save them to ${HOME}/files.json
if: github.event_name != 'workflow_dispatch'
id: files
uses: lots0logs/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set matrix for subsequent build
id: set-matrix
run: |
MATRIX=`python .github/workflows/set_matrix.py`
if [ "${MATRIX}" ]; then
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
else
exit 1
fi
build:
name: ${{ matrix.example }} ${{ matrix.toolchain }} ${{ matrix.os }}
needs: set_matrix
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.set_matrix.outputs.matrix) }}
env:
TOOLCHAIN: ${{ matrix.toolchain }}
PROJECT_DIR: examples/${{ matrix.example }}
GITHUB_USER_PASSWORD: ${{ secrets.CPP_PM_BOT_TOKEN }}
steps:
- name: Git checkout with submodules
uses: actions/[email protected]
with:
submodules: true
- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python }}
- name: Set up Python environment variable (Unix)
if: runner.os != 'Windows'
run: echo "HUNTER_PYTHON_LOCATION=$pythonLocation" >> $GITHUB_ENV
- name: Set up Python environment variable (Windows)
if: runner.os == 'Windows'
run: echo "HUNTER_PYTHON_LOCATION=$env:pythonLocation" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
- name: Build hunter_tests Unix
if: runner.os != 'Windows' && matrix.toolchain == 'hunter_tests'
env:
PROJECT_DIR: ${{ matrix.example }}
run: |
bash ${{ matrix.script }}
- name: Build on Unix
if: runner.os != 'Windows' && matrix.toolchain != 'hunter_tests'
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
bash ${{ matrix.script }}
- name: Build on Windows
if: runner.os == 'Windows' && matrix.toolchain != 'hunter_tests'
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
${{ matrix.script }}
set_status:
needs: [ set_matrix, build ]
if: always() && needs.set_matrix.result == 'success' && github.event_name != 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/[email protected]
- name: Get job status via GitHub API
uses: octokit/[email protected]
id: get_job_data
with:
route: GET /repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Parse job status
run: |
mkdir job_data
echo '${{ steps.get_job_data.outputs.data }}' > job_data.json
python .github/workflows/set_status.py
- name: Deploy job status to GitHub Pages
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: job_data
destination_dir: _data/projects
keep_files: true
enable_jekyll: true