Skip to content

Add automatic code formatting with prettier #270

Add automatic code formatting with prettier

Add automatic code formatting with prettier #270

Workflow file for this run

name: PR-CI
on:
pull_request:
branches:
- 'master'
- 'RF-*'
jobs:
lint:
name: Code Quality Check
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Get pnpm store directory
shell: bash
run: echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.PNPM_STORE_PATH }}
key: ${{ github.job }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ github.job }}-pnpm-store-
- name: Initialise build environment
run: make init
- name: ESLint
run: pnpm lint
- name: Prettier
run: pnpm exec prettier --check .
linux:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Get pnpm store directory
shell: bash
run: echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.PNPM_STORE_PATH }}
key: ${{ github.job }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ github.job }}-pnpm-store-
- name: Set build variables
run: |
PR=${GITHUB_REF}
PR=${PR%%/merge}
PR=${PR##*/}
echo "GIT_PR=${PR}" >> ${GITHUB_ENV}
echo "GIT_VER=PR${PR}-${GITHUB_SHA:0:7}" >> ${GITHUB_ENV}
cat ${GITHUB_ENV}
- name: Update version number
run: make version SEMVER="0.0.0-${{ env.GIT_VER }}"
- name: Initialise build environment
run: make init
- name: Build release for linux64
run: pnpm gulp redist --platform linux --arch x86_64
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: rotorflight-configurator-linux-${{ env.GIT_VER }}
path: redist/*
macos-x86_64:
runs-on: macos-13
needs: lint
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Get pnpm store directory
shell: bash
run: echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.PNPM_STORE_PATH }}
key: ${{ github.job }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ github.job }}-pnpm-store-
- name: Set build variables
run: |
PR=${GITHUB_REF}
PR=${PR%%/merge}
PR=${PR##*/}
echo "GIT_PR=${PR}" >> ${GITHUB_ENV}
echo "GIT_VER=PR${PR}-${GITHUB_SHA:0:7}" >> ${GITHUB_ENV}
cat ${GITHUB_ENV}
- name: Update version number
run: make version SEMVER="0.0.0-${{ env.GIT_VER }}"
- name: Initialise build environment
run: make init
- name: Build release for MacOS
run: pnpm gulp redist --platform osx --arch x86_64
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: rotorflight-configurator-macos-x86_64-${{ env.GIT_VER }}
path: redist/*
macos-arm64:
runs-on: macos-latest
needs: lint
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Get pnpm store directory
shell: bash
run: echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.PNPM_STORE_PATH }}
key: ${{ github.job }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ github.job }}-pnpm-store-
- name: Set build variables
run: |
PR=${GITHUB_REF}
PR=${PR%%/merge}
PR=${PR##*/}
echo "GIT_PR=${PR}" >> ${GITHUB_ENV}
echo "GIT_VER=PR${PR}-${GITHUB_SHA:0:7}" >> ${GITHUB_ENV}
cat ${GITHUB_ENV}
- name: Update version number
run: make version SEMVER="0.0.0-${{ env.GIT_VER }}"
- name: Initialise build environment
run: make init
- name: Build release for MacOS
run: pnpm gulp redist --platform osx --arch arm64
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: rotorflight-configurator-macos-arm64-${{ env.GIT_VER }}
path: redist/*
win64:
runs-on: windows-latest
needs: lint
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Get pnpm store directory
shell: bash
run: echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.PNPM_STORE_PATH }}
key: ${{ github.job }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ github.job }}-pnpm-store-
- name: Set build variables
run: |
$PR = $env:GITHUB_REF
$PR = $PR -replace '/merge',''
$PR = $PR -replace '.*/',''
echo "GIT_PR=$PR" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$VER = $env:GITHUB_SHA.substring(0,7)
echo "GIT_VER=PR$PR-$VER" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Update version number
run: make version SEMVER="0.0.0-${{ env.GIT_VER }}"
- name: Initialise build environment
run: make init
- name: Build release for windows
run: pnpm gulp redist --platform win --arch x86_64
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: rotorflight-configurator-win64-${{ env.GIT_VER }}
path: redist/*
win32:
runs-on: windows-latest
needs: lint
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Get pnpm store directory
shell: bash
run: echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.PNPM_STORE_PATH }}
key: ${{ github.job }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ github.job }}-pnpm-store-
- name: Set build variables
run: |
$PR = $env:GITHUB_REF
$PR = $PR -replace '/merge',''
$PR = $PR -replace '.*/',''
echo "GIT_PR=$PR" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
$VER = $env:GITHUB_SHA.substring(0,7)
echo "GIT_VER=PR$PR-$VER" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Update version number
run: make version SEMVER="0.0.0-${{ env.GIT_VER }}"
- name: Initialise build environment
run: make init
- name: Build release for windows
run: pnpm gulp redist --platform win --arch x86
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: rotorflight-configurator-win32-${{ env.GIT_VER }}
path: redist/*
android:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Get pnpm store directory
shell: bash
run: echo "PNPM_STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.PNPM_STORE_PATH }}
key: ${{ github.job }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml', 'cordova/pnpm-lock.yaml') }}
restore-keys: |
${{ github.job }}-pnpm-store-
- name: Install Java JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '11'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
cmdline-tools-version: 9123335
packages: 'tools platform-tools platforms;android-33 build-tools;33.0.2'
- name: Set build variables
run: |
PR=${GITHUB_REF}
PR=${PR%%/merge}
PR=${PR##*/}
echo "GIT_PR=${PR}" >> ${GITHUB_ENV}
echo "GIT_VER=PR${PR}-${GITHUB_SHA:0:7}" >> ${GITHUB_ENV}
cat ${GITHUB_ENV}
- name: Update version number
run: make version SEMVER="0.0.1-${{ env.GIT_VER }}"
- name: Initialise build environment
run: make init
- name: Build release for Android
run: pnpm gulp redist --platform android
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: rotorflight-configurator-android-${{ env.GIT_VER }}
path: redist/*