Merge pull request #116 from SpartanWorks/adc-cube-fit #88
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: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
# Allows to run this via the Actions tab | |
workflow_dispatch: | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check which part is affected | |
id: source-affected | |
uses: dorny/paths-filter@v2 | |
with: | |
filters: | | |
ui: | |
- 'ui/**' | |
device: | |
- 'device/**' | |
agent: | |
- 'agent/**' | |
outputs: | |
uiAffected: ${{ steps.source-affected.outputs.ui }} | |
deviceAffected: ${{ steps.source-affected.outputs.device }} | |
agentAffected: ${{ steps.source-affected.outputs.agent }} | |
ci-ui: | |
needs: setup | |
if: ${{ needs.setup.outputs.uiAffected == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
- uses: browser-actions/setup-chrome@latest | |
- name: Install deps | |
working-directory: ./ui | |
run: npm install | |
- name: Build the code | |
working-directory: ./ui | |
run: npm run build:ci | |
ci-device: | |
needs: setup | |
if: ${{ needs.setup.outputs.deviceAffected == 'true' }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
board: | |
- esp32dev | |
- esp01 | |
- esp07 | |
- esp12e | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install PlatformIO Core | |
run: pip install --upgrade platformio | |
- name: Build the code | |
working-directory: ./device | |
run: pio run -e ${{ matrix.board }} | |
ci-agent: | |
needs: setup | |
if: ${{ needs.setup.outputs.agentAffected == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- uses: coursier/cache-action@v6 | |
- name: Install Coursier & SBT | |
uses: coursier/setup-action@v1 | |
- name: Test the code | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: ./agent | |
run: sbt coverage test coverageReport | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: agent/target/scala-3.2.2/scoverage-report/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: agent/target/test-reports/ | |
- name: Build a Docker image | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: ./agent | |
run: sbt Docker/publishLocal | |
- name: Build a GraalVM native-image | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: ./agent | |
run: sbt GraalVMNativeImage/packageBin |