Commit Graph

43 Commits

Author SHA1 Message Date
aiuto 36433a92a4
Update to new stardoc so we can work with bzlmod. (#853)
* Update to new stardoc so we can work with bzlmod.
* Requires update to merge.py to account for stardoc changes.
* put integration test back on bazel at head.

Fixes #808
2024-04-16 22:17:21 -04:00
Tony Aiuto ea21d3860c use bazel 7.0.0 for stardoc test 2024-04-15 23:06:01 -04:00
aiuto 20100ce982
Remove expand_yml.py. (#837)
It is not used by anything and my security team is complaing about vulns.
This is the path of least resistance.
2024-03-20 23:44:11 -04:00
aiuto 4af684f66b
Fill out the CI matrix to cover the bazels that people use. (#807)
* Fill out the CI matrix to cover the bazels that people use.

- bazel at head, LTS (7.x) and LTS-1
- with and without bzlmod enabled.

* add names to replicate the task names - CI should do this rather than making them
2024-01-10 09:17:10 -05:00
Tony Aiuto bc0f33d082 back off 2023-12-19 14:35:34 -05:00
Tony Aiuto 7ac7d81198 try stardoc again 2023-12-19 14:34:06 -05:00
Tony Aiuto a0a0b28551 turn off doc building in CI 2023-12-19 14:21:09 -05:00
aiuto dd4cb3ca99
CI fixes (#784)
* do not use bzlmod for integration test

* change distro target

* split out doc_build to non bzlmod
2023-11-22 09:33:50 -05:00
Yun Peng e97d155ebe
Don't load cc toolchain from rules_cc (#779)
* Don't load cc toolchain from rules_cc

The cc toolchain autoconfig is out of sync from Bazel and doesn't work with VS2022.

Related: https://github.com/bazelbuild/continuous-integration/pull/1770
* Fixes centos7
2023-11-07 11:28:30 -05:00
aiuto 8e5570cf44
Get bzlmod working in CI (#766)
Get bzlmod CI working
* fix a lot of python which needs tochange
* make extension for rpmbuild
* restore macos CI to rolling
* better documentation on how to use rpmbuild.
* no docbuild with bzlmod -> stardoc problems
* disable a tar test that can not work with bzlmod

Next: Split rpmbuild to a separately distributable artifact
2023-10-31 09:23:37 -04:00
aiuto 2b391f233c
Use rules_cc to try to clean up CI runs which are failing on gcc (#764)
* try useing rules_cc to clean up CI runs which are failing on gcc"

* use their toolchains

* add rules_cc so the tests run

* do not do distro tests on rolling macos

* only tests tests/... for rolling_macos
2023-10-24 18:11:32 -04:00
aiuto 006af3e393
When pkg_tar.prefix_dir == base of symlink path, don't double-dip. (#749)
* Correct for case where tar has prefix_dir and files/symlinks, but the
user has already mapped the prefix_dir into those paths. Under the old
behavior, prefix_dir was (incorrectly) not added to symlinks, so some
users made the desired prefix part of the link.  Protecting them
against the double inclusion of the prefix is probably the least
surprising behavior.

Add tests for this, which required improving verify_archive_test.

* make buildifier happy

* do not run the symlink test on windows

* huh? why are symlinks in a tree failing on CI?
2023-10-16 16:10:06 -04:00
aiuto 311a81ad12
remove --incompatible_use_platforms_repo_for_constraints from ci run (#755)
* remove --incompatible_use_platforms_repo_for_constraints from ci run

* yaml
2023-09-18 16:39:46 -04:00
aiuto 3fe3cd1cc7
fix working dir on integration tests (#701)
* fix working dir on integration test configuration
2023-05-18 10:14:51 -04:00
aiuto 7c2983c869
pkg_zip: Some unicode file handling fixes and basic tests (#641)
Add primitive zip unicode filename handling tests
- Just make sure we can create an archive with non-ASCII file names.
2023-02-13 23:25:09 -05:00
aiuto 694e3ad1b3
Update to rules_license 0.0.4 (#667)
- Update to a newer rules_license
- update ci to prove that we can work with --incompatible_use_platforms_repo_for_constraints
- do not test with no_host_transition yet
2023-02-09 17:49:20 -05:00
aiuto 0cac0ab710
Create basic bzlmod setup for rules_pkg. (#625)
* Create basic bzlmod setup for rules_pkg.

- Shows it working for one example
- Has only runtime deps
- rpm and git toolchains not done yet
- Still not sure how to get the external repo test working
- Make platforms and stardoc dependency deps.
2022-10-20 10:46:25 -04:00
aiuto 51d7195595
move make_rpm_test to tests/rpm (#542) 2022-04-01 11:41:27 -04:00
Andrew Psaltis 39b75b517b
Restore RPM tests in CI; minor cleanup (#527)
* Restore RPM tests in CI; factor rpm test skipping int terms of `*skip_rpm`

During this month's public meeting, we discovered that none of the RPM packaging tests were not being run in CI.  This looks like it was overlooked as of 85eabf2.

This change fixes this by leaving rpm tests off by default and adding `default_tests_with_rpm` for the platforms which can run rpmbuild.
2022-02-08 11:09:20 -05:00
aiuto 002daac66e
Improved doc generation: Produce a single reference doc. (#474)
* Improved doc generation: Produce a single reference doc.

- moves doc generation out of distro into a separate doc_build tree
- creates a single reference.md from the common attributes section
  plus the individual page.

Future plans
- post transform the .html to add links between sections
- post transform the .html to add external links to Bazel docs.
- add procedures to cut doc releases alongside distribution releases
2021-12-07 01:15:58 -05:00
aiuto 3c520a1bec
Reorganize the source tree (#443)
* Reorganize the source tree

- WORKSPACE moves up one level
  - this makes //:pkg.bzl effectively //pkg:pkg.bzl
  - put forwarders in place at top level to not break anyone
- tests moves up one level
- toolchains moves up one level
- examples/**/BUILD do not change to the new rule locations
  - this is explicitly to provide some proof that the forwarders work
  - new examples should use the proper paths to .bzl files
  - near the 1.x release we can clean the current ones up

Fixes: #111
2021-11-03 22:44:26 -04:00
aiuto 85eabf2414
Add presubmit tests against Bazel rolling, instead of just LTS (#430)
* Refactor presubmit tests for LTS & head.
2021-10-19 20:17:51 -04:00
aiuto d27efa9e4a
Start testing UTF-8 handling. (#376)
* Start testing for UTF-8 handling.
  - create some files with UTF-8 encoded names
  - add a simple test to see if we process them correctly
  - templatize the manifest golden tests.

Future plans:
  - Integration tests with pkg_tar/zip/...
  - pkg_mkdir of UTF-8 string
  - Fix bazel to support UTF-8 better, and re-enable windows tests
  - Decide if we should test 4-byte (emoticon) files?
     - 4-byte chars in file names does not work on Windows 10
2021-10-18 16:54:47 -04:00
aiuto c8e31a51f2
add missing files from examples (#403)
* add missing files from examples
* add the tests
2021-08-18 09:23:49 -04:00
Andrew Psaltis 05d4ebe47c
Provide `pkg_install` for a "make install"-like experience in Bazel (#380)
This change provides the `pkg_install` macro, which allows users to create
runnable installation scripts directly from Bazel BUILD files.

Installation scripts are generated from a template that consumes the manifest
files currently known to `pkg_tar`.  They are intended to be run by `bazel run`,
although they can be run within Bazel as tools if needed.  See the documentation
of `pkg_install` in `pkg/install.bzl` for usage details.

`pkg_install` is currently incomplete.  In particular, the implementation so far
only supports installing files and directories on UNIXy platforms.  The
following are not yet supported:

- Changing of Windows permissions outside of the context of UNIX permissions
- Installation of symbolic links and TreeArtifacts
- Control of default permissions/attributes

The following are not adequately tested due to other complications:
- Changing of file ownership (UNIX group/user)

Full support for Windows is likely to occur separately.

Other changes include:
- Support for emitting "short" paths as manifest destinations (needed to support
  `bazel run`)

Advances #308.
2021-07-30 13:24:43 -04:00
aiuto 55aee4968d
Enable more tests on windows (#364)
* Enable more tests on windows
- fix distro/packaging_test for portability
- simply enable more in tests.yaml
2021-06-09 13:57:35 -04:00
aiuto e24fbddf6d
ubuntu16 is dead (#346) 2021-05-17 20:43:15 -04:00
aiuto 21b3017457
Fix most mapping tests to work on windows. (#350)
* Fix mapping tests to work on windows.

The problem is the sh_binary emits an extra "name.exe".
The tests were failing because the .exe was not expected.
Instead we strip it from the content matcher.
It's a hack, but that is fine for a test.
2021-05-17 14:26:30 -04:00
aiuto 14f174c717
Fix compression detection from tar file extension. (#345)
* Fix detection of compression from tar file extension
- so that a '.' is not required in the extension itself.
- add some tests to see that we really do compress the right way.
- fixes bug where user could specify `extension=".tar.gz"` and get the wrong thing
2021-05-05 17:16:50 -04:00
Andrew Psaltis 25b6178f50
Graduate experimental pkg_rpm to mainline (#338)
The `pkg_filegroup` framework has evolved considerably since its creation, and
the `rpm` packaging rule that uses it (in `pkg/experimental/rpm.bzl`) has as
well.  We believe it is time to move it out of `experimental` and into general
use.

This change moves `pkg/experimental/rpm.bzl` to `pkg/rpm_pfg.bzl` for direct
access, and the compatibility macro in `pkg/rpm.bzl` modified to use it.  All
tests have been updated and moved to subdirectories of `pkg/tests/rpm`.
`pkg/legacy/rpm.bzl` was also updated to indicate its deprecated status.  Distro
packaging and CI configuration were also updated.

`@rules_pkg` has been opportunistically removed from `load`s in test BUILD files
as observed.  There's likely a few other places where it would need to be
cleaned up.

Resolves #307.
2021-05-04 10:17:21 -04:00
Andrew Psaltis fe1260cc8b
Deprecate pkg/rpm.bzl and move it to pkg/legacy/rpm.bzl (#337)
The `pkg_filegroup` framework has evolved considerably since its creation, and
the `rpm` packaging rule that uses it (in `pkg/experimental/rpm.bzl`) has as
well.  We believe it is time to move it out of `experimental` and into general
use.

This change prepares for this by:

- Moving the existing `pkg/rpm.bzl` module and its associated tests to new
  package in `pkg/legacy`.

- Replacing the contents `pkg/rpm.bzl` with a compatibility macro that allows
  for easily switching between the two (the interfaces are significantly
  different).  The macro switches between the two based on mandatory attributes
  that are available in one instance of `pkg_rpm` but not the other.

CI, packaging, and test targets were also updated as needed.

Part of #307.
2021-04-30 07:57:51 -04:00
Michael Hackner 0687a001f6
Support custom compression program (#320)
* Support custom compression program
2021-04-21 14:29:07 -04:00
Andrew Psaltis a7d44afad1
experimental/rpm.bzl: use rpmbuild toolchain; test RPMs in CentOS (#318)
This change modifies the `pkg_rpm` rule in `pkg/experimental/rpm.bzl` to use the
rpmbuild toolchain currently in use by the existing RPM packaging rule in
`pkg/rpm.bzl`.

Additionally, the RPM tests were removed from the disabled test set for CentOS
hosts.  Enablement on systems that do not have a working `rpmbuild` binary
requires additional work that was attempted and found to be non-trivial.

Documentation was also updated to reflect bazel version compatibility, along
with other minor tweaks.  Most notably, the use of `pkg_filegroup` and related
rules requires Bazel 4.0.0.

Fixes #299, partially resolves #183.
2021-03-17 11:24:52 -04:00
aiuto e99c70753d
Make helpers_test work on Windows (#272)
* Make helpers_test work on Windows

We can't run the test from within a NamedTemporaryFile context because
the file is locked while being written so we can not read it. So use a
NamedDirectory, create the file, close the file, and then check the content.
2021-02-03 10:02:12 -05:00
aiuto 835c9d55f7
Make archive_test and pkg_tar_test work on Windows (#271)
* try to make archive test work on windows
* handle / in expected file paths
* is TarFileWriter really the problem?
* same patch to add_tar
* do a test the right way
* cleanups
* fix impact of normpath
* got it!
* try another
2021-01-20 14:12:20 -05:00
aiuto 875dabddfc
Add examples of how to name packages with build time values. (#256)
* Move examples tree and create one for naming packages.

TIL that having examples with their own WORKSPACE inside the scope of the
main WORKSPACE leads to strange behavior. Doing
```
bazel test ...
```
from the top would try to build the examples, which we don't want.

* add an example of package naming
2021-01-19 15:32:42 -05:00
aiuto 9e3c83f55c
split rpm tests out so they are easier to exclude for mac buildkite runs (#242)
* split rpm tests out so they are easier to exclude for mac buildkite runs

* tweakit

* nocruft

* try windows

* nope

* copyrights
2020-09-30 12:10:23 -04:00
aiuto 933fa6fc7f
Convert pkg_deb tests from shell to python (#211)
* Replace build_deb_test.sh with pkg_deb_test.py
* enable deb test on macos and windows
* remove third_party bashunit
* test needs hack on windows for  #213 and #214
2020-08-07 11:22:20 -04:00
aiuto 4b0b9f4679
Add windows to presubmit tests. (#206)
Admin override because this is not code. This is adding more tests to the CI.

* add windows to CI. Not everything, but enough to get started
* fix a missing dependency
* remove all but one test because path.py is broken for windows.
2020-07-15 14:59:02 -04:00
Andrew Psaltis 19930f0988
Provide tests for experimental/pkg_rpm.bzl (#160)
* Provide tests for experimental/pkg_rpm.bzl

This change provides a basic test system for testing changes to the experimental
`pkg_filegroup`-based RPM generator.  The test framework itself is a python script
that makes several calls out to `rpm(8)`'s query command on a generated RPM, and
comparing output information to expected values.

This could also be theoretically applied to the existing RPM generator, if so
desired.

There is more that could be tested here, but this is adequate in the meantime to
demonstrate how this might be applied to other RPM features.

* Switch up python string concat

* Improve test manifest formatting, test completeness

- Fix file size calculations.  Turns out the issue was related to following
  symlinks.

- Take @aiuto's suggestion for formatting the RPM CSV manifest writing for
  improved maintainability

* Allow experimental RPM builder tests to pass on CentOS 7 and CentOS 8

Tests on CentOS 8 with the RPM generator test code fail due to:

- RPM file changing magic
- Directory size calculation changes
  (2cf7096ba5)

This change accounts for these issues by ignoring RPM spec file "magic" and
throwing out the whole concept of "size" to begin with (hashes are good enough),
respectively.

Quoting was also opportunistically adjusted in the manifest CSV `genrule`.

* Add centos 7 test target; tag rpm tests as not runnable on macOS or Windows

* Disable the experimental RPM packaging test until CI has rpmbuild(8)

See #183.

* Whoops, forgot macOS.

Add some more explanatory comments while I'm at it.
2020-05-26 16:53:23 -04:00
aiuto 06e57ddaa6
add macos to CI, fix most tests, skip some others (#168)
* add macos to CI, fix  most tests, skip some others

* forgot a :

* still no sign of land

* attempt to fix working_dir for macos

* ... but that fumblefingered linux, so put that back
2020-05-04 14:24:53 -04:00
aiuto d5ff66e7ce
fix CI setup (#167)
* add starter CI setup

* remove unneded name

* refactor up common parts

* space

* fix working_directory for CI runs

* fix pointer to CI
2020-05-04 11:10:54 -04:00
aiuto eea3f696ca
Add starter CI setup (#165)
* add starter CI setup

* remove unneded name

* refactor up common parts

* space
2020-04-29 12:03:07 -04:00