Skip to content

Commit

Permalink
Workflow improvements (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
vchernin committed Jul 28, 2022
1 parent 250f14c commit e31beb3
Show file tree
Hide file tree
Showing 6 changed files with 230 additions and 34 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
189 changes: 189 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

name: CI
jobs:
prepare:
name: Prepare
runs-on: ubuntu-20.04
outputs:
github_commit_desc: ${{ steps.get_commit_desc.outputs.github_commit_desc }}
steps:
- name: Checkout
uses: actions/checkout@v3.0.2
with:
fetch-depth: 0

- name: Get head branch latest commit
run: echo "GITHUB_PR_HEAD_SHA=$(git log --pretty=format:'%h' $GITHUB_SHA^2 -1)" >> $GITHUB_ENV

- name: Get base branch latest commit
run: echo "GITHUB_PR_BASE_SHA=$(git log --pretty=format:'%h' $GITHUB_SHA^1 -1)" >> $GITHUB_ENV

- name: Get latest commit
run: echo "GITHUB_HEAD_SHA=$(git log --pretty=format:'%h' -1)" >> $GITHUB_ENV

- id: get_commit_desc
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
echo "::set-output name=github_commit_desc::merge-${{ env.GITHUB_PR_HEAD_SHA }}-into-${{ env.GITHUB_PR_BASE_SHA }}"
else
echo "::set-output name=github_commit_desc::master-${{ env.GITHUB_HEAD_SHA }}"
fi
flatpak:
name: Flatpak
runs-on: ubuntu-20.04
env:
FLATPAK_BUILD_PATH: flatpak_app/files/share
needs: prepare
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-42
options: --privileged
strategy:
matrix:
arch: [x86_64, aarch64]
# Don't fail the whole workflow if one architecture fails
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3.0.2

- name: Install deps
run: dnf -y install docker

- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2.0.0
with:
platforms: arm64

- uses: bilelmoussaoui/flatpak-github-actions/flatpak-builder@v4
with:
bundle: easyeffects-flatpak-${{ needs.prepare.outputs.github_commit_desc }}.flatpak
manifest-path: util/flatpak/com.github.wwmm.easyeffects.json
cache-key: flatpak-builder-${{ github.sha }}
arch: ${{ matrix.arch }}
run-tests: true

# we also validate appstream in the appstream-news-validate job,
# but we still should specifically ensure the flatpak outputs it properly
- name: Validate AppStream
shell: bash
working-directory: ${{ env.FLATPAK_BUILD_PATH }}
run: |
appstream-util validate-relax appdata/com.github.wwmm.easyeffects.appdata.xml
- name: Verify icon and metadata in app-info
shell: bash
working-directory: ${{ env.FLATPAK_BUILD_PATH }}
run: |
test -f app-info/icons/flatpak/128x128/com.github.wwmm.easyeffects.png || { echo "Missing 128x128 icon in app-info" ; exit 1; }
test -f app-info/xmls/com.github.wwmm.easyeffects.xml.gz || { echo "Missing com.github.wwmm.easyeffects.xml.gz in app-info" ; exit 1; }
arch-linux:
name: Arch Linux
runs-on: ubuntu-20.04
needs: prepare
steps:
- name: Checkout
uses: actions/checkout@v3.0.2
with:
# needed for getting git describe info for pkgver() in pkgbuild
fetch-depth: 0

- name: Save commit description to file
run: echo ${{ needs.prepare.outputs.github_commit_desc }} >> GITHUB_COMMIT_DESC

- name: Makepkg Build and Check
id: makepkg
uses: vchernin/pkgbuild-action@master
with:
# todo this doesn't work
namcapExcludeRules: unusedsodepends

- name: Upload Package Archive
uses: actions/upload-artifact@v3.1.0
with:
name: easyeffects-archlinux-${{ needs.prepare.outputs.github_commit_desc }}-x86_64
path: ${{ steps.makepkg.outputs.pkgfile0 }}
if-no-files-found: error

analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
security-events: write
container:
image: archlinux
strategy:
fail-fast: false
matrix:
language: [ 'cpp', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3.0.2

- name: Install deps
run: |
pacman -Syu --noconfirm ninja gcc pkgconf python3 python-pip which
source ./PKGBUILD && pacman -Syu --noconfirm --needed --asdeps "${makedepends[@]}" "${depends[@]}"
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - name: Build
# run: |
# echo "Run, Build Application using script"
# meson builddir && cd builddir
# meson compile
# cd ..
# exit

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
# with:
# sha: ${{ github.sha }}
# ref: ${{ github.ref }}

appstream-news-validate:
name: AppStream and News validate
runs-on: ubuntu-20.04
container:
# normally we'd use archlinux for up-to-date builds, but appstream-util 0.8.0 doesn't work
# https://github.com/hughsie/appstream-glib/issues/449
image: fedora:35
steps:
- name: Checkout code
uses: actions/checkout@v3.0.2

- name: Install deps
run: dnf -y install appstream libappstream-glib libxslt which

- name: Validate existing files
run: ./util/update-release-files.sh --no-new-release
19 changes: 0 additions & 19 deletions .github/workflows/flatpak-build.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/flatpak-update.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: Check for flatpak module updates
name: Flatpak dependency updates
on:
schedule: # for scheduling to work this file must be in the default branch
- cron: "0 0 * * *" # run every day
workflow_dispatch: # can be manually dispatched under GitHub's "Actions" tab

jobs:
flatpak-external-data-checker:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04

strategy:
matrix:
branch: [ master ] # list all branches to check

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3.0.2
with:
ref: ${{ matrix.branch }}

Expand Down
30 changes: 20 additions & 10 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,38 +1,48 @@
# Contributor: Wellington <wellingtonwallace@gmail.com>
# Maintainer: Upstream https://github.com/wwmm/easyeffects

pkgname=easyeffects-git
pkgver=6.1.4.r19.gc63c5dd3
pkgver=pkgvernotupdated
pkgrel=1
pkgdesc='Audio Effects for PipeWire Applications'
arch=(x86_64)
url='https://github.com/wwmm/easyeffects'
license=('GPL3')
depends=('gtk4' 'libadwaita' 'glib2' 'pipewire-pulse' 'lilv' 'lv2' 'libsigc++-3.0' 'libsndfile' 'libsamplerate' 'zita-convolver'
'libebur128' 'rnnoise' 'rubberband' 'fftw' 'libbs2b' 'speexdsp' 'nlohmann-json' 'tbb' 'fmt')
makedepends=('meson' 'itstool' 'appstream-glib')
depends=('libadwaita' 'pipewire-pulse' 'lilv' 'libsigc++-3.0' 'libsamplerate' 'zita-convolver'
'libebur128' 'rnnoise' 'rubberband' 'libbs2b' 'nlohmann-json' 'tbb' 'fmt')
makedepends=('meson' 'itstool' 'appstream-glib' 'git')
optdepends=('calf: limiter, exciter, bass enhancer and others'
'lsp-plugins: equalizer, compressor, delay, loudness'
'zam-plugins: maximizer'
'mda.lv2: bass loudness'
'yelp: in-app help')
source=("easyeffects::git+https://github.com/wwmm/easyeffects.git")
conflicts=(easyeffects)
provides=(easyeffects)
replaces=('pulseeffects')
sha512sums=('SKIP')
sha512sums=()

pkgver() {
cd easyeffects

git describe --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
description=$(git describe --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')
# if in github actions environment
if test -f "../GITHUB_COMMIT_DESC"; then
# remove last commit from git describe output (which may sometimes be a merge commit),
# and replace it with a human friendly version
description_short=$(echo "$description" | sed -r 's/(.*)\..*/\1/')
github_commit_desc_no_hyphen=$(sed 's/-/./g' ../GITHUB_COMMIT_DESC)
printf "%s" "${description_short}.${github_commit_desc_no_hyphen}"
else
printf "%s" "$description"
fi
}

build() {
arch-meson easyeffects build
cd ..
arch-meson . build

ninja -C build
}

package() {
cd ..
DESTDIR="${pkgdir}" ninja install -C build
}
14 changes: 12 additions & 2 deletions util/update-release-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

# no means just refresh changelog and metainfo with current news.yaml file, will assume template is present representing a future relase.
# The future release at the top of NEWS.yaml will not be included (since you are only regenerating current releases).
read -r -e -p "Create a new release? (y/n): " MAKE_NEW_RELEASE

set -o nounset
set -o noglob
Expand Down Expand Up @@ -316,7 +315,18 @@ convert_news_to_metainfo() {
rm "${TEMP_NEWS_CLEANED:?}"

}

set +o nounset
if [[ "$1" == "--make-new-release" ]]; then
MAKE_NEW_RELEASE='y'
elif [[ "$1" == "--no-new-release" ]]; then
MAKE_NEW_RELEASE='n'
elif [[ ! "$1" == "" ]]; then
log_err "Unknown argument, exiting \n"
exit 1
else
read -r -e -p "Create a new release? (y/n): " MAKE_NEW_RELEASE
fi
set -o nounset


if ! [ "${MAKE_NEW_RELEASE}" == y ] && ! [ "${MAKE_NEW_RELEASE}" == n ]
Expand Down

0 comments on commit e31beb3

Please sign in to comment.