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 Dec 9, 2023
1 parent 644f6cf commit b50b25b
Show file tree
Hide file tree
Showing 53 changed files with 729 additions and 558 deletions.
29 changes: 20 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,22 @@ 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-pref-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: Ensure Python requirements .txt files are in sync with .in files
run: |
Expand All @@ -102,7 +109,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 +126,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@v3
with:
name: pack
path: "*.shell-extension.zip"
path: "build/*.shell-extension.zip"
if-no-files-found: error
40 changes: 15 additions & 25 deletions .github/workflows/check-po.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,21 @@ on:

env:
FORCE_COLOR: 1
PIP_DISABLE_PIP_VERSION_CHECK: 1

jobs:
configure:
runs-on: ubuntu-latest

outputs:
pofiles: ${{ steps.generate.outputs.pofiles }}
linguas: ${{ steps.generate.outputs.linguas }}

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

- name: Generate .po file list
- name: Read language list
id: generate
shell: python
run: |
import json
import os
import pathlib
import uuid
delimiter = f'ghadelimiter_{uuid.uuid4()}'
value = json.dumps([str(p) for p in pathlib.Path('.').glob('po/*.po')])
with open(os.environ['GITHUB_OUTPUT'], 'a') as fp:
print(f'pofiles<<{delimiter}', file=fp)
print(value, file=fp)
print(delimiter, file=fp)
run: echo "linguas=$(jq -Rcn '[inputs]' locale/LINGUAS)" >>$GITHUB_OUTPUT

check:
needs: configure
Expand All @@ -44,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pofile: ${{ fromJson(needs.configure.outputs.pofiles) }}
lang: ${{ fromJson(needs.configure.outputs.linguas) }}

steps:
- name: Checkout
Expand All @@ -53,22 +39,26 @@ jobs:

- 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: Prepare build directory
run: meson setup build
if: ${{ always() && steps.checkout.conclusion == 'success' }}

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

- name: Compile translation
run: make msgfmt/${{ matrix.pofile }} 2>&1 | tee $GITHUB_STEP_SUMMARY
run: ninja -j1 -v msgfmt-${{ matrix.lang }} 2>&1 | tee $GITHUB_STEP_SUMMARY
shell: bash
working-directory: build

- 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.pofile }} 2>&1
run: ninja -j1 --quiet msgcmp-${{ matrix.lang }} 2>&1
shell: bash
working-directory: build
if: ${{ always() && steps.checkout.conclusion == 'success' }}
9 changes: 7 additions & 2 deletions .github/workflows/pot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- master

env:
PO_FILES: po/*.po po/*.pot
PO_FILES: locale/*.po locale/*.pot

jobs:
pot:
Expand All @@ -33,8 +33,13 @@ jobs:
- name: Enable generic error matcher
run: echo "::add-matcher::.github/problem-matchers/generic.json"

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

- name: Update .pot files
run: po/update-pot.sh
run: ninja -j1 pot
working-directory: build

- name: Check if there are any changes
id: diff
Expand Down
16 changes: 5 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
*~
/node_modules/

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

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

0 comments on commit b50b25b

Please sign in to comment.