Skip to content

Commit eb95a85

Browse files
committed
chore: use [Bats Wrapper GitHub action](https://github.com/marketplace/actions/bats-wrapper)
1 parent 81664b1 commit eb95a85

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+794
-1139
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
custom: https://www.paypal.me/bkahlert
1+
custom: paypal.me/bkahlert

.github/workflows/build.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ on:
1010
tags: ['dependencies']
1111
paths-ignore: ['**.md']
1212

13+
concurrency:
14+
group: ${{ github.ref }}
15+
cancel-in-progress: true
16+
1317
env:
1418
REGISTRY: ghcr.io
1519
IMAGE_NAME: ${{ github.repository }}
@@ -67,7 +71,7 @@ jobs:
6771
run: |
6872
echo ::set-output name=build_tag::test
6973
echo ::set-output name=test_dir::test
70-
echo ::set-output name=test_reports_dir::build/test-reports
74+
echo ::set-output name=test_reports_dir::build/bats-tmp/test-reports
7175
echo ::set-output name=test_reports_format::junit
7276
7377
- name: Build test
@@ -78,18 +82,20 @@ jobs:
7882
DEFAULT_TAG: ${{ steps.prep.outputs.build_tag }}
7983

8084
- name: Run tests
81-
run: |
82-
chmod +x batsw
83-
./batsw "${{ steps.prep.outputs.test_dir }}" \
84-
--env BUILD_TAG="${{ steps.prep.outputs.build_tag }}" \
85-
--report-formatter "${{ steps.prep.outputs.test_reports_format }}" \
86-
--output "${{ steps.prep.outputs.test_reports_dir }}"
85+
uses: bkahlert/bats-wrapper@v0.1.4
86+
env:
87+
BATSW_ARGS: --env BUILD_TAG="${{ steps.prep.outputs.build_tag }}"
88+
with:
89+
report-formatter: ${{ steps.prep.outputs.test_reports_format }}
90+
output: ${{ steps.prep.outputs.test_reports_dir }}
91+
tests: ${{ steps.prep.outputs.test_dir }}
8792

8893
- name: Upload test reports
8994
uses: actions/upload-artifact@v2
9095
if: success() || failure()
9196
with:
9297
name: test-reports
98+
if-no-files-found: error
9399
path: ${{ steps.prep.outputs.test_reports_dir }}/*.xml
94100

95101
- name: Build
@@ -115,15 +121,21 @@ jobs:
115121
docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
116122
docker image inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
117123
118-
publish:
124+
release-draft:
119125
needs: build
120126
runs-on: ubuntu-latest
127+
if: startsWith(github.ref, 'refs/tags/v')
128+
permissions:
129+
contents: write
121130

122131
steps:
132+
- name: Checkout
133+
uses: actions/checkout@v2
134+
123135
- name: Draft release
124136
uses: softprops/action-gh-release@v1
125-
if: startsWith(github.ref, 'refs/tags/v')
126137
with:
127138
draft: true
128-
body_part: CHANGELOG.md
139+
body_path: CHANGELOG.md
140+
files: recordr
129141
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/docs.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: docs
2+
3+
on:
4+
push:
5+
branches: ['master']
6+
tags: ['v*']
7+
paths-ignore: ['**.md','**.svg']
8+
pull_request:
9+
branches: ['master']
10+
tags: ['dependencies']
11+
paths-ignore: ['**.md','**.svg']
12+
workflow_dispatch:
13+
14+
concurrency:
15+
group: ${{ github.ref }}--docs
16+
cancel-in-progress: true
17+
18+
jobs:
19+
docs:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Prepare
24+
id: prep
25+
run: |
26+
echo ::set-output name=recordr-branch::"${{ github.ref_name }}--docs"
27+
echo ::set-output name=recordr-build-dir::"build/rec"
28+
29+
- name: Checkout
30+
uses: actions/checkout@v2
31+
32+
- name: ● REC terminal sessions
33+
if: github.event_name != 'pull_request'
34+
id: recordr
35+
uses: bkahlert/recordr@v0.2.2
36+
with:
37+
branch: ${{ steps.prep.outputs.recordr-branch }}
38+
build-dir: ${{ steps.prep.outputs.recordr-build-dir }}
39+
40+
- name: Upload ● REC artifacts
41+
uses: actions/upload-artifact@v2
42+
if: success() || failure()
43+
with:
44+
name: rec-artifacts
45+
if-no-files-found: error
46+
path: ${{ steps.prep.outputs.recordr-build-dir }}
47+
48+
- name: Create pull request
49+
uses: peter-evans/create-pull-request@v3
50+
if: startsWith(github.ref, 'refs/heads/')
51+
with:
52+
commit-message: |
53+
${{ github.workflow }}(docs): update ${{ steps.recordr.outputs.file-list }}
54+
title: |
55+
${{ github.workflow }}(docs): update ${{ steps.recordr.outputs.file-list }}
56+
body: |
57+
Updates ${{ steps.recordr.outputs.file-list }}
58+
${{ steps.recordr.outputs.markdown }}
59+
labels: recordr,docs,rec
60+
branch: ${{ steps.prep.outputs.recordr-branch }}

.run/build and run tests.run.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="libguestfs: build and test" type="ShConfigurationType">
3+
<option name="defaultInterpreter" value="posix" />
4+
<option name="SCRIPT_TEXT" value="curl -LfsS https://git.io/batsw | &quot;$SHELL&quot; -s -- --batsw:-e --batsw:BUILD_TAG=test test" />
5+
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
6+
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/../libguestfs/batsw" />
7+
<option name="SCRIPT_OPTIONS" value="" />
8+
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
9+
<option name="SCRIPT_WORKING_DIRECTORY" value="$ModuleFileDir$" />
10+
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
11+
<option name="INTERPRETER_PATH" value="" />
12+
<option name="INTERPRETER_OPTIONS" value="" />
13+
<option name="EXECUTE_SCRIPT_FILE" value="false" />
14+
<envs>
15+
<env name="DOCKER_BAKE" value="--set '*.tags=test'" />
16+
</envs>
17+
<RunnerSettings bashdbVersion="Automatic" bashPathMapper="Automatic" RunnerId="pro.bashsupport.shDebugRunner" />
18+
<method v="2" />
19+
</configuration>
20+
</component>

.run/libguestfs.test.run.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="libguestfs: test" type="ShConfigurationType">
3+
<option name="defaultInterpreter" value="posix" />
4+
<option name="SCRIPT_TEXT" value="curl -LfsS https://git.io/batsw | &quot;$SHELL&quot; -s -- --batsw:-e --batsw:BUILD_TAG=test test" />
5+
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
6+
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/../libguestfs/batsw" />
7+
<option name="SCRIPT_OPTIONS" value="" />
8+
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
9+
<option name="SCRIPT_WORKING_DIRECTORY" value="$ModuleFileDir$" />
10+
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
11+
<option name="INTERPRETER_PATH" value="" />
12+
<option name="INTERPRETER_OPTIONS" value="" />
13+
<option name="EXECUTE_SCRIPT_FILE" value="false" />
14+
<envs />
15+
<RunnerSettings bashdbVersion="Automatic" bashPathMapper="Automatic" RunnerId="pro.bashsupport.shDebugRunner" />
16+
<method v="2" />
17+
</configuration>
18+
</component>

.run/run tests.run.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 62 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,67 @@
11
# Changelog
22

3-
## 1.2.1 (2021-10-10)
4-
* Cleanup
5-
* Add tests
3+
## [Unreleased]
64

7-
## 1.2.0 (2021-09-26)
8-
* Automated testing of scripts
9-
* Simplified usage of container
5+
### Added
106

11-
## 1.1.0 (2021-09-21)
12-
* Support for working with non-root user
13-
* Automated testing of container using GitHub actions
7+
*none*
148

15-
## 1.0.0 (2021-09-06)
16-
* Initial version using semver
9+
### Changed
10+
11+
*none*
12+
13+
### Deprecated
14+
15+
*none*
16+
17+
### Removed
18+
19+
*none*
20+
21+
### Fixed
22+
23+
*none*
24+
25+
## [1.3.0] - 2021-12-06
26+
27+
### Fixed
28+
29+
- support `--batsw:` style arguments also if script is downloaded and executed directly
30+
31+
## [1.2.1] — 2021-10-10
32+
33+
### Changed
34+
35+
- Configuration is now applied on each start; not just on build time
36+
37+
## [1.2.0] - 2021-09-26
38+
39+
### Changed
40+
41+
- Simplified usage of container
42+
- Automated testing of scripts
43+
44+
## [1.1.0] - 2021-09-21
45+
46+
### Added
47+
48+
- Support for working with non-root user
49+
- Automated testing of container using GitHub actions
50+
51+
## [1.0.0] - 2021-09-06
52+
53+
### Added
54+
55+
- Docker image containing libguestfs command line tools
56+
57+
[unreleased]: https://github.com/bkahlert/libguestfs/compare/v1.3.0...HEAD
58+
59+
[1.3.0]: https://github.com/bkahlert/libguestfs/compare/v1.2.1...v1.3.0
60+
61+
[1.2.1]: https://github.com/bkahlert/libguestfs/compare/v1.2.0...v1.2.1
62+
63+
[1.2.0]: https://github.com/bkahlert/libguestfs/compare/v1.1.0...v1.2.0
64+
65+
[1.1.0]: https://github.com/bkahlert/libguestfs/compare/v1.0.0...v1.1.0
66+
67+
[1.0.0]: https://github.com/bkahlert/libguestfs/releases/tag/v1.0.0

CITATION.cff

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cff-version: 1.2.0
2+
message: "If you use this software, please cite it as below."
3+
authors:
4+
- given-names: "Björn"
5+
family-names: "Kahlert"
6+
orcid: "https://orcid.org/0000-0003-1705-4067"
7+
title: "Libguestfs - Containerized libguestfs including virt-customize, guestfish, etc."
8+
version: 1.3.0
9+
date-released: 2021-12-03
10+
url: "https://github.com/bkahlert/libguestfs"

Dockerfile

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
FROM ubuntu:20.04
22

33
# build time only options
4+
ARG LOGR_VERSION=0.6.2
45
ARG APP_USER=libguestfs
56
ARG APP_GROUP=$APP_USER
67

78
# build and run time options
9+
ARG DEBUG=0
810
ARG TZ=UTC
11+
ARG LANG=C.UTF-8
912
ARG PUID=1000
1013
ARG PGID=1000
1114
ARG LIBGUESTFS_DEBUG=0
1215
ARG LIBGUESTFS_TRACE=0
1316

17+
# dependencies
1418
RUN apt-get update \
1519
&& DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \
1620
ca-certificates \
@@ -20,33 +24,40 @@ RUN apt-get update \
2024
linux-image-generic \
2125
qemu-utils \
2226
tzdata \
23-
&& groupadd \
24-
--gid "$PGID" \
25-
"$APP_GROUP" \
26-
&& useradd \
27-
--uid $PUID \
28-
--gid "$APP_GROUP" \
29-
--shell /bin/bash \
30-
"$APP_USER" \
3127
&& rm -rf /tmp/* /var/lib/apt/list/*
3228

29+
# app setup
3330
COPY --from=crazymax/yasu:1.17.0 / /
3431
COPY rootfs /
3532
RUN chmod +x \
36-
/usr/local/bin/entrypoint_user.sh \
3733
/usr/local/sbin/entrypoint.sh \
34+
/usr/local/bin/entrypoint_user.sh \
3835
&& sed -Ei -e "s/([[:space:]]app_user=)[^[:space:]]*/\1$APP_USER/" \
3936
-e "s/([[:space:]]app_group=)[^[:space:]]*/\1$APP_GROUP/" \
4037
/usr/local/sbin/entrypoint.sh \
41-
&& curl -LfsSo /usr/local/bin/logr.sh https://raw.githubusercontent.com/bkahlert/logr/master/logr.sh
38+
&& curl -LfsSo /usr/local/bin/logr.sh https://github.com/bkahlert/logr/releases/download/v${LOGR_VERSION}/logr.sh
4239

43-
ENV TZ="$TZ" \
44-
LANG="C.UTF-8" \
40+
# env setup
41+
ENV DEBUG="$DEBUG" \
42+
TZ="$TZ" \
43+
LANG="$LANG" \
4544
PUID="$PUID" \
4645
PGID="$PGID" \
4746
LIBGUESTFS_DEBUG="$LIBGUESTFS_DEBUG" \
4847
LIBGUESTFS_TRACE="$LIBGUESTFS_TRACE"
4948

49+
# user setup
50+
RUN groupadd \
51+
--gid "$PGID" \
52+
"$APP_GROUP" \
53+
&& useradd \
54+
--comment "app user" \
55+
--uid $PUID \
56+
--gid "$APP_GROUP" \
57+
--shell /bin/bash \
58+
"$APP_USER"
59+
60+
# finalization
5061
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/sbin/entrypoint.sh"]
5162
CMD ["echo", "Usage: COMMAND [ARG...]\nExample: guestfish --version"]
5263

0 commit comments

Comments
 (0)