Skip to content

Commit

Permalink
[WIP] Meson build system
Browse files Browse the repository at this point in the history
  • Loading branch information
amezin committed Jan 8, 2024
1 parent aa60034 commit acd570a
Show file tree
Hide file tree
Showing 49 changed files with 877 additions and 627 deletions.
4 changes: 2 additions & 2 deletions .github/problem-matchers/generic.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"owner": "generic",
"pattern": [
{
"regexp": "^([^\\s:]+):(\\d+)(?::(\\d+))?:?\\s+(?:((?i)warning|error):?)?\\s*(.+)$",
"regexp": "^(?:\\.\\./)?([^\\s:]+):(\\d+)(?::(\\d+))?:?\\s+(?:((?i)warning|error):?)?\\s*(.+)$",
"file": 1,
"line": 2,
"column": 3,
Expand All @@ -17,7 +17,7 @@
"owner": "generic-nolocation",
"pattern": [
{
"regexp": "^(?:([^\\s:]+):?\\s+)?((?i)warning|error):?\\s*(.+)$",
"regexp": "^(?:\\.\\./)?(?:([^\\s:]+):?\\s+)?((?i)warning|error):?\\s*(.+)$",
"file": 1,
"severity": 2,
"message": 3
Expand Down
2 changes: 1 addition & 1 deletion .github/problem-matchers/gettext-stats.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"severity": "warning",
"pattern": [
{
"regexp": "msgfmt .* --statistics .* (po/.*\\.po)",
"regexp": "(?:^|\\s)(?:\\.\\./)?(locale/.*\\.po)$",
"file": 1
},
{
Expand Down
35 changes: 26 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ jobs:

- name: Install JS dependencies
id: npm
run: npm ci
run: npm install
if: ${{ always() && steps.checkout.conclusion == 'success' }}

- name: Lint JS code
run: make "ESLINT_OPTS=--format .github/eslint-formatter.js" lint
run: npm run-script lint -- --format .github/eslint-formatter.js
if: ${{ always() && steps.npm.conclusion == 'success' }}

- name: Pre-create pip cache directory
Expand All @@ -75,15 +75,28 @@ jobs:
run: echo "::add-matcher::.github/problem-matchers/generic.json"
if: ${{ always() && steps.checkout.conclusion == 'success' }}

- id: meson-setup
name: Prepare build directory
run: meson setup build
if: ${{ always() && steps.checkout.conclusion == 'success' }}

- name: Compile GSettings schemas
run: make schemas 2>&1 | tee schemas.log
run: ninja -j1 schemas 2>&1 | tee schemas.log
working-directory: build
shell: bash
if: ${{ always() && steps.checkout.conclusion == 'success' }}
if: ${{ always() && steps.meson-setup.conclusion == 'success' }}

- name: Validate Gtk .ui files
run: xvfb-run make gtk-builder-validate 2>&1 | tee gtk-builder.log
run: xvfb-run ninja -j1 validate-ui 2>&1 | tee gtk-builder.log
working-directory: build
shell: bash
if: ${{ always() && steps.checkout.conclusion == 'success' }}
if: ${{ always() && steps.meson-setup.conclusion == 'success' }}

- name: Validate .desktop file
run: ninja -j1 desktop-file-validate 2>&1 | tee desktop-file-validate.log
working-directory: build
shell: bash
if: ${{ always() && steps.meson-setup.conclusion == 'success' }}

- name: Ensure Python requirements .txt files are in sync with .in files
run: |
Expand All @@ -102,7 +115,7 @@ jobs:
if: ${{ always() && steps.checkout.conclusion == 'success' }}

- name: Upload reports to Testspace
run: testspace --verbose eslint.xml "*.log{lint}"
run: testspace --verbose eslint.xml "build/*.log{lint}"
if: ${{ always() && steps.setup_testspace.outcome == 'success' }}

pack:
Expand All @@ -119,13 +132,17 @@ jobs:
- name: Enable generic error matcher
run: echo "::add-matcher::.github/problem-matchers/generic.json"

- name: Prepare build directory
run: meson setup build

- name: Build extension package
run: xvfb-run make ONLY_RELEASE_LOCALES=true pack
run: xvfb-run ninja -j1 pack
working-directory: build

- name: Upload extension package as artifact
id: upload
uses: actions/upload-artifact@v4
with:
name: pack
path: "*.shell-extension.zip"
path: "build/*.shell-extension.zip"
if-no-files-found: error
20 changes: 9 additions & 11 deletions .github/workflows/check-po.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:

env:
FORCE_COLOR: 1
PIP_DISABLE_PIP_VERSION_CHECK: 1

jobs:
configure:
Expand All @@ -23,7 +22,7 @@ jobs:
echo -n linguas= >>$GITHUB_OUTPUT
grep -Ev '^\s*#.*' LINGUAS | jq -Rcn '[inputs | scan("\\S+")]' >>$GITHUB_OUTPUT
shell: bash
working-directory: po
working-directory: locale

check:
needs: configure
Expand All @@ -39,27 +38,26 @@ jobs:

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- run: git config --global --replace-all safe.directory "$GITHUB_WORKSPACE"

- name: Enable gettext stats problem matcher
run: echo "::add-matcher::.github/problem-matchers/gettext-stats.json"

- name: Enable generic problem matcher
run: echo "::add-matcher::.github/problem-matchers/generic.json"

- name: Enable gettext stats problem matcher
run: echo "::add-matcher::.github/problem-matchers/gettext-stats.json"

- name: Compile translation
run: make msgfmt/${{ matrix.lang }} 2>&1 | tee $GITHUB_STEP_SUMMARY
run: |
echo locale/${{ matrix.lang }}.po
msgfmt --check -v -o /dev/null locale/${{ matrix.lang }}.po 2>&1 | tee $GITHUB_STEP_SUMMARY
shell: bash

- name: Disable gettext stats problem matcher
run: echo "::remove-matcher owner=gettext-stats::"

- name: Ensure .po file is in sync with .pot
run: |
touch po/*.pot # Make sure .pot won't be re-generated
make msgcmp/${{ matrix.lang }} 2>&1
run: msgcmp --use-untranslated --use-fuzzy locale/${{ matrix.lang }}.po locale/*.pot
shell: bash
if: ${{ always() && steps.checkout.conclusion == 'success' }}
if: ${{ always() && steps.meson-setup.conclusion == 'success' }}
60 changes: 34 additions & 26 deletions .github/workflows/pot.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
concurrency:
group: ${{ github.workflow }}/${{ github.ref }}

name: pot

on:
workflow_dispatch:
inputs:
commit:
description: Commit changes
required: false
default: false
type: boolean

workflow_call:
push:
branches:
- master
paths-ignore:
- docs/**
- po/*.po
- README.md
- Vagrantfile
- vagrant-provision/**
inputs:
commit:
description: Commit changes
required: false
default: false
type: boolean

jobs:
pot:
Expand All @@ -23,13 +22,6 @@ jobs:
image: ghcr.io/ddterm/ci-docker-image:meson

steps:
- name: Get app token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_KEY }}

- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -40,24 +32,40 @@ jobs:
- name: Enable generic error matcher
run: echo "::add-matcher::.github/problem-matchers/generic.json"

- name: Update .pot files
run: po/update-pot.sh
- name: Prepare build directory
run: meson setup build

- name: Update POTFILES.in
run: ninja -j1 potfiles
working-directory: build

- name: Update .pot file and merge changes into .po files
run: ninja -j1 msgmerge
working-directory: build

- name: Stage changes
run: git add po/*.po po/*.pot
run: git add locale/*.po locale/*.pot

- name: Check if there are any changes
id: diff
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { stdout } = await exec.getExecOutput('git', ['diff', '--cached']);
const { stdout } = await exec.getExecOutput('git', ['diff', '--cached', '--ignore-matching-lines=^"POT-Creation-Date: ']);
return stdout.trim();
- name: Get app token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_KEY }}
if: secrets.APP_ID

- name: Commit
uses: ddterm/github-api-commit-action@ccf9b520c5698380ad3b9619c5add427369b7ef1
if: steps.diff.outputs.result != ''
with:
token: ${{ steps.app-token.outputs.token }}
commit-message: 'Update translation files'
if: inputs.commit && steps.diff.outputs.result && steps.app-token.conclusion == 'success'
10 changes: 9 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ on:
pull_request:
paths-ignore:
- docs/**
- po/**
- po/*.po
- po/*.pot
- po/POTFILES
- po/POTFILES.in
- README.md
- Vagrantfile
- vagrant-provision/**
Expand All @@ -24,3 +27,8 @@ jobs:
test:
needs: build
uses: ./.github/workflows/test.yml

translations:
uses: ./.github/workflows/pot.yml
with:
commit: false
10 changes: 9 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ on:
- v*
paths-ignore:
- docs/**
- po/**
- po/*.po
- po/*.pot
- po/POTFILES
- po/POTFILES.in
- README.md
- Vagrantfile
- vagrant-provision/**
Expand All @@ -26,3 +29,8 @@ jobs:
test:
needs: build
uses: ./.github/workflows/test.yml

translations:
uses: ./.github/workflows/pot.yml
with:
commit: ${{ github.ref_name == 'master' }}
13 changes: 1 addition & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
*~
/node_modules/

# Makefile output
/*.shell-extension.zip
/ddterm/pref/ui/
/ddterm/com.github.amezin.ddterm.desktop
/ddterm/com.github.amezin.ddterm.desktop.in
/ddterm/com.github.amezin.ddterm.service
/metadata.json
/schemas/gschemas.compiled
/locale/
/tmp/
/revision.txt
/node_modules/

# do-in-docker.sh/do-in-podman.sh
/.container-home/
Expand Down
Loading

0 comments on commit acd570a

Please sign in to comment.