Fix release GHA #352
Workflow file for this run
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@v4 | |
- id: filter | |
uses: dorny/paths-filter@v3 | |
with: | |
filters: | | |
src: | |
- 'platformio.ini' | |
- 'lib/**' | |
- 'src/**' | |
- 'include/**' | |
- '.github/workflows/main.yml' | |
format-conf: | |
- '.clang-format' | |
lint-conf: | |
- '.clang-tidy' | |
docs: | |
- 'book.toml' | |
- 'docs/**' | |
- '.github/workflows/main.yml' | |
- 'theme/**' | |
examples: | |
- 'examples/**' | |
- '.github/workflows/main.yml' | |
outputs: | |
src: ${{ github.ref == 'refs/heads/main' || steps.filter.outputs.src }} | |
format-conf: ${{ steps.filter.outputs.format-conf }} | |
lint-conf: ${{ steps.filter.outputs.lint-conf }} | |
docs: ${{ github.ref == 'refs/heads/main' || steps.filter.outputs.docs }} | |
examples: ${{ github.ref == 'refs/heads/main' || steps.filter.outputs.examples }} | |
pio-build: | |
runs-on: ubuntu-latest | |
needs: changes | |
if: ${{ needs.changes.outputs.src == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v4 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
.pio/cache | |
key: ${{ runner.os }}-pio | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
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' || needs.changes.outputs.format-conf == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- 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' || needs.changes.outputs.lint-conf == 'true' }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
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@v4 | |
- 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@v5 | |
- name: Build | |
run: ./mdbook build | |
- name: Upload artifact | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: actions/upload-pages-artifact@v3 | |
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@v4 |