Commit graph

1014 commits

Author SHA1 Message Date
Katerina Koukiou
6f04071d88
Introduce a github action which builds a cockpit preview when requested
It currently reacts to /livetest comments on PRs and builds cockpit from
the PR's checkout. Then serves it on logs.cockpit-project.org on a port
specified on a follow-up comment to the /livetest.

Cockpit developers can now utilize this workflow to review a PR without
having to pull and compile the code locally.
2021-02-09 13:58:15 +01:00
Martin Pitt
71a321cc28 Enable webpack watch progress
Without that, `npm run watch` is entirely silent after the first build,
and does not give any feedback when a build starts, and even more
importantly, when it's done.
2021-02-01 11:39:58 +01:00
Cockpit Project
dfeb49484c package.json: Update @patternfly package dependencies
Closes #418
2021-01-28 06:03:03 +01:00
Martin Pitt
e031456805 tests: Use cockpit/tasks container in Cirrus CI
This avoids the lengthy (and potentially brittle) installation of
dependencies and having to create an unprivileged user.

Since [1] the tasks container can now fix /dev/kvm permissions.

[1] https://github.com/cockpit-project/cockpituous/pull/366
2021-01-26 14:28:41 +01:00
Martin Pitt
4c3d90d3b3
Run tests on Cirrus CI, drop Travis (#416)
Travis stopped handing out free credits since their plan changes last
November, so tests have not run since then.

Cirrus CI offers an API similar to Travis, and also explicitly supports
/dev/kvm access.

Eventually we want to use the cockpit/tasks container directly. But we
can't fix the /dev/kvm permissions inside that as `sudo` does not work
in that. Once we fix that, the setup will become much cheaper and
simpler.
2021-01-26 05:25:40 +01:00
Martin Pitt
bb06422996
Use Cockpit webpack helpers from cockpit.git
Drop the cockpit-po-plugin.js and sassc-loader.js code copies, and check
them out from a stable cockpit tag, similarly to how we already get the
PatternFly CSS.
2021-01-22 16:04:35 +01:00
Cockpit Project
786fd20df5 package.json: Update core-js package dependency
Closes #415
2021-01-20 05:32:46 +01:00
Martin Pitt
e418cba057 cockpit-po-plugin: Fix crash with plural forms
Declare the `pos` variable. Fixes regression introduced in commit
7f6ef51c12.

Add plural forms to German translations to exercise this code path.
2021-01-07 08:53:23 +01:00
Martin Pitt
7f6ef51c12
Build translations with webpack
Convert the `po2json` script into a webpack plugin, and integrate the
(now trivial) po.empty.js template.

This is the last step for building the entire dist/ directory with
`npm run build` (i.e. a tool that web developers are familiar with),
and not having a split webpack+make toolchain any more.
2021-01-05 14:52:59 +01:00
Martin Pitt
07017f79d8 Eliminate POTFILES.*.in files
The `find` is so cheap that there is little point in the POTFILES.*.in
indirection.
2021-01-04 14:01:59 +01:00
Martin Pitt
88fe99361b Simplify translation template
`this.po` is not being used anywhere, so drop the whole `!loaded` code
path. There is no defer mechanism, so `po.js` *must* be loaded after
cockpit.js. Let's trigger a crash instead of silently dropping
translations, to make such a bug obvious in manual and automatic tests.
2021-01-04 14:01:59 +01:00
Martin Pitt
bb15952fc4 Simplify po.js inclusion
There is no need to jump between directories and even invoke a glob --
the po.<LANG>.js files are right next to index.js.
2021-01-04 14:01:59 +01:00
Martin Pitt
c7f610f489 Fix po2json usage help
The output file is an option, not a positional argument.

`opts.args` is undefined if there are no positional arguments, so that
just calling `po/po2json` crashed with

    TypeError: Cannot read property 'length' of undefined
2021-01-04 14:01:59 +01:00
Martin Pitt
f93ccb26a8 Fix po2json default option arguments
Similarly to commit cbedf06704, provide default values, so that
`po2json po/de.po` does not error out with

    Option "--module" requires 1 arguments, but 0 were provided
2021-01-04 14:01:59 +01:00
Martin Pitt
43c51b979b po: Add Language: header value to German translations 2021-01-04 14:01:59 +01:00
Cockpit Project
de1efaccd3 package.json: Update core-js package dependency
Closes #412
2021-01-04 06:34:07 +01:00
Martin Pitt
670f528781 Adjust test for changed display language modal
f1542d54db rewrote
the language selector dialog. Update the tests to also work with
cockpit ≥ 233.

Do the version comparison dynamically for the time being, as this breaks
several image refreshes. We can drop this again and only use the new
code once all of these landed.
2021-01-01 08:37:23 +01:00
Martin Pitt
3dbd37a8c3
workflows: Move npm-update to Ubuntu 20.04
GitHub's 18.04 additional repositories break NPM. As "ubuntu-latest" is
going to switch to 20.04 soon anyway [1], do the jump now.

[1] https://github.com/actions/virtual-environments/issues/1816

Closes #409
2020-12-28 16:17:11 +01:00
Martin Pitt
539f293b7e webpack: Fix PatternFly font path
Copy the rule that cockpit and cockpit-podman use. Also change the
quoting, to avoid pointless diff noise. Now they are perfectly in sync.
2020-12-17 17:40:47 +01:00
Martin Pitt
dff4b66671 webpack: Only show errors and warnings
Otherwise there is just too much noise and when something is broken, the
error is above 3 pages of pointless logs.

See https://webpack.js.org/configuration/stats/

Cherry-picked from cockpit-podman commit 5989b20a05a.
2020-12-17 17:40:47 +01:00
Martin Pitt
6b8611caab Minimize CSS in production builds
Use optimize-css-assets-webpack-plugin for that. terser-webpack-plugin
was already being used by default, but explicitly import it as our
webpack config now references it directly.

https://webpack.js.org/plugins/mini-css-extract-plugin/#minimizing-for-production

Ported from cockpit-podman commit 3caf54fbfe2.
2020-12-17 17:40:47 +01:00
Martin Pitt
b9616257c2 spec: Add BuildRequires: make
See https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2020-12-17 08:47:17 +01:00
Cockpit Project
34f2b6253c package.json: Update @patternfly/react-core package dependency
Closes #405
2020-12-17 06:07:00 +01:00
Martin Pitt
50ef8a9362
webpack: Show sassc errors
`stdio` is not a valid value for the `stdio` option. This led to sassc's
stdout/err to be hidden, and thus it did not show error messages.

Closes #403

[1] https://nodejs.org/api/child_process.html#child_process_options_stdio
2020-12-16 17:49:02 +01:00
Martin Pitt
8821db1daf
webpack: Check if sassc is installed
If so, show the versions, which may be useful for comparing builds. If
not, show an useful error message. Previously, you were left with ~ 80
identical unintelligible error messages and leftover temporary
directories.

Closes #404
Fixes #391
2020-12-16 17:47:20 +01:00
Cockpit Project
18354174de package.json: Update @patternfly/patternfly package dependency
Closes #402
2020-12-16 10:01:01 +01:00
Cockpit Project
c2a5c6df77 package.json: Update @patternfly/react-core package dependency
Closes #401
2020-12-15 08:27:21 +01:00
Martin Pitt
8771907002 workflows: Fix apt installation in npm-update
GitHub's base VMs don't automatically refresh package indexes, so it can
happen that one of the package dependencies get out of date and are not
available on the mirrors any more.

Run `apt update` first to ensure that the workflow installs the latest
packages.
2020-12-11 10:11:57 +02:00
Cockpit Project
224d9a2a12 package.json: Update core-js package dependency
Closes #399
2020-12-06 07:50:14 +01:00
Martin Pitt
f95b9a0373
workflows: Update release container registry
With [1] the release container moved from dockerhub to GitHub's
container registry, as we both build and use it from GitHub. This avoids
running into docker.io pull limits.

[1] https://github.com/cockpit-project/cockpituous/pull/353

Closes #398
2020-12-02 10:29:38 +01:00
Martin Pitt
7fca9b9a26 webpack: Compress css in production mode
Adjust the WEBPACK_TEST file, as index.css is now not reliable (in
production mode it's .css.gz).

Closes #395
2020-11-26 11:17:04 +01:00
Martin Pitt
61db732b4a webpack: Drop compression plugin's minRatio option
The default of 0.8 is just fine, no need to tweak this.
2020-11-26 11:17:04 +01:00
Martin Pitt
8874e6a233 webpack: Declare constants as such 2020-11-26 11:17:04 +01:00
Martin Pitt
9fd1cf7f3f webpack: Simplify copied files
As `files` is now the only entry in `info`, rename it to a `copy_files`
constant, and drop `info` completely.

Drop the "qualify" loop and add the src/ subdirectory to the path
directly. This is more explicit, thus easier to understand, and simpler.

Drop the now unused "vpath" function.
2020-11-26 11:17:04 +01:00
Martin Pitt
230c338a5a webpack: Simplify module.entries
Drop the "qualify" loop and add the src/ subdirectory to the path
directly. This is more explicit, thus easier to understand, and simpler.

Also move it into the `modules` declaration directly, so that (1) it's
easier to see what it actually means, and (2) info.files is for a
completely different purpose.
2020-11-26 11:17:04 +01:00
Martin Pitt
8aad356edb webpack: Simplify externals declaration
This is simple enough to be inline, and it's also not meant to be
expanded: `cockpit` is the only legit external symbol, everything else
ought to be bundled.
2020-11-26 11:17:04 +01:00
Martin Pitt
8ea62cb4d7 webpack: Drop unnecessary output settings
The default of `path` and `sourceMapFilename` are already what we want,
no need to set them explicitly.

The `output.filename` is already `[name].js`, and it's totally not
important to name the file differently in production mode (it will then
just be `index.js.gz`, compared to index.js in development mode).
2020-11-26 11:17:04 +01:00
Cockpit Project
d3d1df5533 package.json: Update core-js package dependency
Closes #397
2020-11-26 06:25:38 +01:00
Martin Pitt
c1c2d83b81 Bump test/common dependency to 233
This gets rid of the hack for
<https://github.com/cockpit-project/cockpit/issues/14133>.
2020-11-25 21:09:53 +01:00
Cockpit Project
5f3c5c8436 package.json: Update @patternfly/patternfly package dependency
Closes #394
2020-11-22 11:51:57 +01:00
Cockpit Project
b49d1d48dc package.json: Update @patternfly/react-core package dependency
Closes #393
2020-11-19 05:48:47 +01:00
Cockpit Project
92f009d489 package.json: Update core-js package dependency
Closes #392
2020-11-07 16:25:28 +01:00
Cockpit Project
7dacf49b9a package.json: Update @patternfly/react-core package dependency
Closes #389
2020-10-30 06:21:08 +01:00
Martin Pitt
0ea06f9235 Run integration tests in Travis
Travis now offers /dev/kvm, and its machines are powerful enough to run
our browser integration tests, at least for small projects.

Building an RPM on the Ubuntu host environment is a bit tricky, as there
are no installed RPMs. Thus ignore the BuildRequires, and install
appstream-util explicitly. In the future, the rpm/deb build should
happen inside the VM (like Cockpit does).

Add two scenarios for current Fedora and CentOS 8.

Switch to the "minimal" environment to make the test easier to reproduce
locally and more explicit.

Closes #386
2020-10-29 07:23:54 +01:00
Martin Pitt
180dde395e Makefile: Fix PO template generation dependencies
*2po tools need the npm modules installed.
2020-10-29 07:23:54 +01:00
Cockpit Project
fcab193597 package.json: Update @patternfly/patternfly package dependency
Closes #387
2020-10-29 06:49:59 +01:00
Martin Pitt
233b5cfe04 Use sassc instead of node-sass
node-sass is a compiled ELF module, which is problematic for
distributions that want to rebuild everything from source. The sassc CLI
program is packaged everywhere, and both use the same libsass library.

So drop node-sass and sass-loader, and replace it with a simple loader
wrapper around sassc.

This also saves 122 npm packages (16 MB in node_modules/).

Closes #382
2020-10-28 14:49:52 +01:00
Martin Pitt
ea1377da1c Travis: Move to Ubuntu 20.04 LTS 2020-10-28 14:49:52 +01:00
Sanne Raymaekers
3703120a23
Makefile: Bump test/common to 230
Closes #385
2020-10-28 10:15:32 +01:00
Cockpituous
29fb8b5c98 package.json: Update react-dom package dependency
Closes #383
2020-10-20 09:08:39 +02:00