diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f828448 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,16 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "daily" + + - package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/aarch64-devbuild.yml b/.github/workflows/aarch64-devbuild.yml new file mode 100644 index 0000000..046620d --- /dev/null +++ b/.github/workflows/aarch64-devbuild.yml @@ -0,0 +1,64 @@ +name: "Build on ARM" + +on: + push: + branches: + - 'testing-build' + +permissions: + id-token: write + contents: write + packages: write + pull-requests: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Build on ARM + uses: pguyot/arm-runner-action@v2 + id: build_image + with: + copy_artifact_path: dist/react-pywebview-boilerplate + copy_artifact_dest: . + base_image: raspios_lite:latest + cpu: cortex-a7 + cpu_info: cpuinfo/raspberrypi_3b + image_additional_mb: 4096 + commands: | + sudo apt update + sudo apt install python3-pip -y + pip3 install virtualenv + curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - + sudo apt install nodejs -y + npm install --global yarn + yarn run init + export CI=false + yarn run build + - name: Upload executable + uses: actions/upload-artifact@v3 + with: + name: devbuild + path: react-pywebview-boilerplate + + prerelease: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Download Executable + uses: actions/download-artifact@v3 + with: + name: devbuild + - name: Create DevBuild + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "latest" + prerelease: true + title: "Development Build" + files: | + react-pywebview-boilerplate diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml new file mode 100644 index 0000000..47ec963 --- /dev/null +++ b/.github/workflows/auto-release.yml @@ -0,0 +1,65 @@ +name: Create Release + +on: + pull_request: + branches: + - main + types: + - closed + +permissions: + id-token: write + contents: write + packages: write + pull-requests: read + +jobs: + build: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Build on ARM + uses: pguyot/arm-runner-action@v2 + id: build_image + with: + copy_artifact_path: dist/react-pywebview-boilerplate + copy_artifact_dest: . + base_image: raspios_lite:latest + cpu: cortex-a7 + cpu_info: cpuinfo/raspberrypi_3b + image_additional_mb: 4096 + commands: | + sudo apt update + sudo apt install python3-pip -y + pip3 install virtualenv + curl -sL https://deb.nodesource.com/setup_18.x | sudo bash - + sudo apt install nodejs -y + npm install --global yarn + yarn run init + yarn run build + - name: Upload executable + uses: actions/upload-artifact@v3 + with: + name: releasebuild + path: react-pywebview-boilerplate + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Download Executable + uses: actions/download-artifact@v3 + with: + name: releasebuild + - name: Create Release + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ github.event.pull_request.title }}" + prerelease: false + files: | + react-pywebview-boilerplate diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..7f6cb5f --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,42 @@ +name: Lint + +on: + # Replace pull_request with pull_request_target if you + # plan to use this action with forks, see the Limitations section + pull_request: + branches: + - main + - develop + +# Down scope as necessary via https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token +permissions: + checks: write + contents: write + +jobs: + run-linters: + name: Run linters + runs-on: ubuntu-latest + + steps: + - name: Check out Git repository + uses: actions/checkout@v3 + + - name: Set up Python 3 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 + + # fix temporaneo. @Fabrizio ricontrollare configurazione di eslint + - name: Install Node.js dependencies + run: yarn install + + - name: Run linters + uses: wearerequired/lint-action@v2 + with: + xo: true + flake8: true diff --git a/package.json b/package.json index 0da16db..8cfd285 100644 --- a/package.json +++ b/package.json @@ -40,23 +40,19 @@ "cleanall:windows": "if exist node_modules rd /S /Q node_modules & if exist venv-pywebview rd /S /Q venv-pywebview", "init": "yarn install && run-script-os", "init:windows": "virtualenv -p python venv-pywebview && .\\venv-pywebview\\Scripts\\pip install -r requirements.txt", - "init:linux": "virtualenv -p python3 venv-pywebview && if [[ -z \"${KDE_FULL_SESSION}\" ]]; then yarn run init:qt5; else yarn run init:gtk; fi", - "init:default": "virtualenv -p python3 venv-pywebview && ./venv-pywebview/bin/pip install -r requirements.txt", - "init:qt5": "./venv-pywebview/bin/pip install pyqt5 pyqtwebengine -r requirements.txt", - "init:gtk": "./venv-pywebview/bin/pip install pycairo PyGObject -r requirements.txt", - "//init:gtk": "sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0 && ./venv-pywebview/bin/pip install pycairo pygobject -r requirements.txt", + "init:linux": "virtualenv -p python3 venv-pywebview && yarn run init:gtk", + "init:default": "virtualenv -p python4 venv-pywebview && ./venv-pywebview/bin/pip install -r requirements.txt", + "init:gtk": "sudo apt install -y libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0 && ./venv-pywebview/bin/pip install pycairo pygobject -r requirements.txt", "init:docs": "./venv-pywebview/bin/pip install pylama yapf", "start": "export NODE_OPTIONS='--openssl-legacy-provider' && yarn run frontend:dev && run-script-os", "start:windows": ".\\venv-pywebview\\Scripts\\python src\\index.py", "start:default": "./venv-pywebview/bin/python src/index.py", "pylintcheck": "pylama -f pylint ./src/", - "pylint": "yapf --recursive -i ./src/" + "pylint": "yapf --recursive -i ./src/", + "lint": "xo src/" }, - "eslintConfig": { - "extends": [ - "react-app", - "react-app/jest" - ] + "xo": { + "extends": "xo-react" }, "browserslist": { "production": [ @@ -71,6 +67,15 @@ ] }, "devDependencies": { - "run-script-os": "^1.1.6" + "eslint": "^8.41.0", + "eslint-config-standard": "^17.1.0", + "eslint-config-xo-react": "^0.27.0", + "eslint-plugin-import": "^2.25.2", + "eslint-plugin-n": "^15.0.0 || ^16.0.0 ", + "eslint-plugin-promise": "^6.0.0", + "eslint-plugin-react": "^7.32.2", + "eslint-plugin-react-hooks": "^4.6.0", + "run-script-os": "^1.1.6", + "xo": "^0.54.2" } }