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 32eaf49
Show file tree
Hide file tree
Showing 47 changed files with 850 additions and 604 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
47 changes: 38 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,40 @@ 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: Update POTFILES.in
run: ninja -j1 potfiles && git diff
working-directory: build
shell: bash
if: ${{ always() && steps.meson-setup.conclusion == 'success' }}

- name: Update .pot file and merge changes into .po files
run: ninja -j1 msgmerge && git diff
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 +127,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 +144,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' }}
18 changes: 13 additions & 5 deletions .github/workflows/pot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- master
paths-ignore:
- docs/**
- po/*.po
- locale/**
- README.md
- Vagrantfile
- vagrant-provision/**
Expand Down Expand Up @@ -40,19 +40,27 @@ 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: Commit
Expand Down
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 32eaf49

Please sign in to comment.