chore: format with black #312
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: Build & Lint & Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
name: Lint Python & XML files | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3 | |
- name: Setup Python 3 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
- name: Retrieve the cached "node_modules" directory (if present) | |
uses: actions/cache@v3 | |
id: node-cache | |
with: | |
path: node_modules | |
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies (if the cached directory was not found) | |
if: steps.node-cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Install xmllint (which the "lint.sh" script uses) | |
run: sudo apt-get update && sudo apt-get install libxml2-utils -y | |
#- name: First, black the repository and commit, if needed | |
# run: bash black.sh "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY" | |
- name: Lint | |
run: bash lint.sh | |
discord: | |
name: Discord Failure Notification | |
needs: [lint] | |
# We don't want to spam the Discord channel when people have failing pull requests. | |
if: failure() && github.event_name != 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: sarisia/actions-status-discord@v1 | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
status: failure | |
title: "" | |
pyinstaller_trigger: | |
name: Build a Windows executable | |
needs: [lint] | |
if: "contains(github.event.head_commit.message, 'chore: release') && github.event_name != 'pull_request'" | |
runs-on: windows-latest | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v2 | |
- name: Setup Python 3 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pyinstaller | |
- name: Build a Windows executable | |
run: | | |
python win_build.py | |
- name: Determine next build number | |
uses: MCKanpolat/auto-semver-action@1.0.5 | |
id: versioning | |
with: | |
releaseType: patch | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create a release archive | |
run: | | |
powershell Compress-Archive dist/* BasementRenovator.zip | |
- name: Upload release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "BasementRenovator.zip" | |
tag: ${{steps.versioning.outputs.version}} | |
token: ${{ secrets.GITHUB_TOKEN }} |