Merge pull request #83 from rogy-AquaLab/handatuke_tutorial #143
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: Main CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- id: filter | |
uses: dorny/paths-filter@v2 | |
with: | |
filters: | | |
src: | |
- 'platformio.ini' | |
- 'lib/**' | |
- 'src/**' | |
- 'include/**' | |
- '.github/workflows/main.yml' | |
docs: | |
- 'book.toml' | |
- 'docs/**' | |
- '.github/workflows/main.yml' | |
examples: | |
- 'examples/**' | |
- '.github/workflows/main.yml' | |
outputs: | |
src: ${{ steps.filter.outputs.src }} | |
docs: ${{ steps.filter.outputs.docs }} | |
examples: ${{ steps.filter.outputs.examples }} | |
pio-build: | |
runs-on: ubuntu-latest | |
needs: changes | |
if: ${{ needs.changes.outputs.src == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Run PlatformIO | |
run: pio run | |
clang-format: | |
runs-on: ubuntu-latest | |
needs: changes | |
if: ${{ needs.changes.outputs.src == 'true' || needs.changes.outputs.examples == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Check clang-format | |
uses: DoozyX/[email protected] | |
with: | |
source: "./src ./include ./examples" | |
extensions: "h,hpp,c,cpp" | |
clangFormatVersion: 11 | |
style: file | |
inplace: false | |
clang-tidy: | |
runs-on: ubuntu-latest | |
needs: changes | |
if: ${{ needs.changes.outputs.src == 'true' || needs.changes.outputs.examples == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Check | |
run: pio check --fail-on-defect=high | |
mdbook: | |
env: | |
MDBOOK_VERSION: v0.4.36 | |
runs-on: ubuntu-latest | |
needs: changes | |
if: ${{ needs.changes.outputs.docs == 'true' }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- name: Prepare mdbook | |
run: curl -sSL https://github.com/rust-lang/mdBook/releases/download/${MDBOOK_VERSION}/mdbook-${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz | tar -xz | |
- name: Deploy to GitHub Pages | |
if: ${{ github.event_name != 'pull_request' }} | |
id: pages | |
uses: actions/configure-pages@v3 | |
- name: Build | |
run: ./mdbook build | |
- name: Upload artifact | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./book | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: mdbook | |
if: ${{ github.event_name != 'pull_request' }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |