update workflow config

This commit is contained in:
sebthom
2023-12-06 02:44:55 +01:00
parent 4f76007c7a
commit 804c6e7a6e
2 changed files with 38 additions and 8 deletions

View File

@@ -12,4 +12,6 @@ updates:
prefix-development: chore prefix-development: chore
include: scope include: scope
labels: labels:
- pinned
- dependencies - dependencies
- gha

View File

@@ -2,23 +2,33 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# SPDX-ArtifactOfProjectHomePage: https://github.com/Second-Hand-Friends/kleinanzeigen-bot/ # SPDX-ArtifactOfProjectHomePage: https://github.com/Second-Hand-Friends/kleinanzeigen-bot/
# #
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
name: Build name: Build
on: on:
push: push:
branches-ignore: branches-ignore: # build all branches except:
- 'dependabot/**' # prevent GHA triggered twice (once for commit to the branch and once for opening/syncing the PR) - 'dependabot/**' # prevent GHA triggered twice (once for commit to the branch and once for opening/syncing the PR)
- 'dependencies/pdm' # prevent GHA triggered twice (once for commit to the branch and once for opening/syncing the PR) - 'dependencies/pdm' # prevent GHA triggered twice (once for commit to the branch and once for opening/syncing the PR)
tags-ignore: tags-ignore: # don't build tags
- '**' - '**'
paths-ignore: paths-ignore:
- '**/*.md' - '**/*.md'
- '.editorconfig'
- '.git*'
- '.github/*.yml' - '.github/*.yml'
- '.github/ISSUE_TEMPLATE/*' - '.github/ISSUE_TEMPLATE/*'
- '.github/workflows/codeql-analysis.yml' - '.github/workflows/codeql-analysis.yml'
- '.github/workflows/update-python-deps.yml' - '.github/workflows/update-python-deps.yml'
pull_request: pull_request:
paths-ignore:
- '**/*.md'
- '.editorconfig'
- '.git*'
- '.github/*.yml'
- '.github/ISSUE_TEMPLATE/*'
- '.github/workflows/codeql-analysis.yml'
- '.github/workflows/update-python-deps.yml'
workflow_dispatch: workflow_dispatch:
# https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/ # https://github.blog/changelog/2020-07-06-github-actions-manual-triggers-with-workflow_dispatch/
@@ -57,13 +67,14 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Git checkout - name: Git checkout
uses: actions/checkout@v4 #https://github.com/actions/checkout uses: actions/checkout@v4 #https://github.com/actions/checkout
- name: Configure Fast APT Mirror - name: Configure Fast APT Mirror
uses: vegardit/fast-apt-mirror.sh@v1 uses: vegardit/fast-apt-mirror.sh@v1
- name: Install Chromium Browser - name: Install Chromium Browser
if: env.ACT == 'true' && startsWith(matrix.os, 'ubuntu') if: env.ACT == 'true' && startsWith(matrix.os, 'ubuntu')
run: | run: |
@@ -73,39 +84,44 @@ jobs:
sudo apt-get --no-install-recommends -y --fix-broken install sudo apt-get --no-install-recommends -y --fix-broken install
fi fi
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:
python-version: "${{ matrix.PYTHON_VERSION }}" python-version: "${{ matrix.PYTHON_VERSION }}"
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: __pypackages__ path: __pypackages__
key: ${{ runner.os }}-pypackages-${{ hashFiles('pdm.lock') }} key: ${{ runner.os }}-pypackages-${{ hashFiles('pdm.lock') }}
- name: "Install: Python dependencies" - name: "Install: Python dependencies"
run: | run: |
set -eux set -eux
python --version python --version
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install --upgrade pdm pip install --upgrade pdm
pdm install -v pdm install -v
- name: Display project metadata - name: Display project metadata
run: pdm show run: pdm show
- name: Security scan - name: Security scan
run: pdm run scan run: pdm run scan
- name: Check code style - name: Check code style
run: pdm run lint run: pdm run lint
- name: Run unit tests - name: Run unit tests
run: pdm run utest run: pdm run utest
- name: Run integration tests - name: Run integration tests
run: | run: |
set -eux set -eux
@@ -119,6 +135,7 @@ jobs:
;; ;;
esac esac
- name: Run app from source - name: Run app from source
run: | run: |
echo " echo "
@@ -133,10 +150,12 @@ jobs:
pdm run app version pdm run app version
pdm run app verify pdm run app verify
- name: "Install: binutils (strip)" - name: "Install: binutils (strip)"
if: startsWith(matrix.os, 'ubuntu') if: startsWith(matrix.os, 'ubuntu')
run: sudo apt-get install --no-install-recommends -y binutils run: sudo apt-get install --no-install-recommends -y binutils
- name: "Install: UPX" - name: "Install: UPX"
if: startsWith(matrix.os, 'windows') if: startsWith(matrix.os, 'windows')
run: | run: |
@@ -161,6 +180,7 @@ jobs:
ls -l dist ls -l dist
- name: Run self-contained executable - name: Run self-contained executable
run: | run: |
set -eux set -eux
@@ -169,6 +189,7 @@ jobs:
dist/kleinanzeigen-bot version dist/kleinanzeigen-bot version
dist/kleinanzeigen-bot verify dist/kleinanzeigen-bot verify
- name: Upload self-contained executable - name: Upload self-contained executable
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: ${{ github.ref_name == 'main' && matrix.PUBLISH_RELEASE && !env.ACT }} if: ${{ github.ref_name == 'main' && matrix.PUBLISH_RELEASE && !env.ACT }}
@@ -176,6 +197,7 @@ jobs:
name: artifacts-${{ matrix.os }} name: artifacts-${{ matrix.os }}
path: dist/kleinanzeigen-bot* path: dist/kleinanzeigen-bot*
- name: Build Docker image - name: Build Docker image
if: startsWith(matrix.os, 'ubuntu') if: startsWith(matrix.os, 'ubuntu')
run: | run: |
@@ -185,6 +207,7 @@ jobs:
docker run --rm second-hand-friends/kleinanzeigen-bot help docker run --rm second-hand-friends/kleinanzeigen-bot help
- name: Publish Docker image - name: Publish Docker image
if: ${{ github.ref_name == 'main' && matrix.PUBLISH_RELEASE && startsWith(matrix.os, 'ubuntu') && !env.ACT }} if: ${{ github.ref_name == 'main' && matrix.PUBLISH_RELEASE && startsWith(matrix.os, 'ubuntu') && !env.ACT }}
run: | run: |
@@ -211,6 +234,7 @@ jobs:
# only required by "gh release create" to prevent "fatal: Not a git repository" # only required by "gh release create" to prevent "fatal: Not a git repository"
uses: actions/checkout@v4 #https://github.com/actions/checkout uses: actions/checkout@v4 #https://github.com/actions/checkout
- name: Generate GitHub access token - name: Generate GitHub access token
uses: tibdex/github-app-token@v2 #https://github.com/tibdex/github-app-token uses: tibdex/github-app-token@v2 #https://github.com/tibdex/github-app-token
id: generate_token id: generate_token
@@ -220,15 +244,18 @@ jobs:
app_id: ${{ secrets.DEPS_UPDATER_APP_ID }} app_id: ${{ secrets.DEPS_UPDATER_APP_ID }}
private_key: ${{ secrets.DEPS_UPDATER_PRIVATE_KEY }} private_key: ${{ secrets.DEPS_UPDATER_PRIVATE_KEY }}
- name: Delete untagged docker image - name: Delete untagged docker image
continue-on-error: true continue-on-error: true
uses: camargo/delete-untagged-action@v1 uses: camargo/delete-untagged-action@v1
with: with:
github-token: ${{ steps.generate_token.outputs.token }} github-token: ${{ steps.generate_token.outputs.token }}
- name: Download build artifacts - name: Download build artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
- name: "Delete previous 'latest' release" - name: "Delete previous 'latest' release"
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -251,7 +278,7 @@ jobs:
# https://cli.github.com/manual/gh_release_create # https://cli.github.com/manual/gh_release_create
GH_DEBUG=1 gh release create "$RELEASE_NAME" \ GH_DEBUG=1 gh release create "$RELEASE_NAME" \
--prerelease \ --title "$RELEASE_NAME" \
--latest \ --latest \
--notes "${{ github.event.head_commit.message }}" \ --notes "${{ github.event.head_commit.message }}" \
--target "${{ github.sha }}" \ --target "${{ github.sha }}" \
@@ -259,6 +286,7 @@ jobs:
kleinanzeigen-bot-linux-amd64 \ kleinanzeigen-bot-linux-amd64 \
kleinanzeigen-bot-windows-amd64.exe kleinanzeigen-bot-windows-amd64.exe
- name: "Delete intermediate build artifacts" - name: "Delete intermediate build artifacts"
uses: geekyeggo/delete-artifact@v2 # https://github.com/GeekyEggo/delete-artifact/ uses: geekyeggo/delete-artifact@v2 # https://github.com/GeekyEggo/delete-artifact/
with: with: