Skip to content

Commit 9bff3d3

Browse files
committed
Test Linux on docker images
1 parent 14199de commit 9bff3d3

Some content is hidden

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

58 files changed

+6088
-8
lines changed

Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ rig-$(VERSION).tar.gz: target/release/rig
5555
curl -L -o build/share/rig/cacert.pem 'https://curl.se/ca/cacert.pem'
5656
tar cz -C build -f $@ bin share
5757

58-
VARIANTS = ubuntu-20.04 ubuntu-22.04 debian-11 debian-12 centos-7 centos-8 rockylinux-8 rockylinux-9 opensuse/leap-15.3 opensuse/leap-15.4 fedora-37 fedora-38 almalinux-8 almalinux-9
58+
VARIANTS = ubuntu-20.04 ubuntu-22.04 debian-11 debian-12 centos-7 rockylinux-8 rockylinux-9 opensuse/leap-15.3 opensuse/leap-15.4 fedora-37 fedora-38 almalinux-8 almalinux-9
5959
print-linux-variants:
6060
@echo $(VARIANTS)
6161

@@ -68,7 +68,9 @@ linux-in-docker:
6868

6969
define GEN_TESTS
7070
linux-test-$(variant): rig-$(VERSION).tar.gz
71-
docker run --rm -v $(PWD):/work `echo $(variant) | tr - :` bash -c /work/tests/test-linux-docker.sh
71+
docker run -t --rm -v $(PWD):/work `echo $(variant) | tr - :` bash -c /work/tests/test-linux-docker.sh
72+
shell-$(variant):
73+
docker run -ti --rm -v $(PWD):/work `echo $(variant) | tr - :` bash
7274
TEST_IMAGES += linux-test-$(variant)
7375
endef
7476
$(foreach variant, $(VARIANTS), $(eval $(GEN_TESTS)))

tests/bats/.codespellrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[codespell]
2+
skip = .git,*.pdf,*.svg
3+
ignore-words-list = dne

tests/bats/.devcontainer/Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
ARG bashver=latest
2+
3+
FROM bash:${bashver}
4+
5+
# Install parallel and accept the citation notice (we aren't using this in a
6+
# context where it make sense to cite GNU Parallel).
7+
RUN echo "@edgecomm http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
8+
apk update && \
9+
apk add --no-cache parallel ncurses shellcheck@edgecomm && \
10+
mkdir -p ~/.parallel && touch ~/.parallel/will-cite && \
11+
curl -sSfL https://github.com/shenwei356/rush/releases/download/v0.5.0/rush_linux_amd64.tar.gz | tar xzf - -C /usr/local/bin && \
12+
chmod +x /usr/local/bin/rush
13+
14+
RUN ln -s /opt/bats/bin/bats /usr/sbin/bats
15+
COPY . /opt/bats/
16+
17+
ENTRYPOINT ["bash", "/usr/sbin/bats"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Bats core development environment",
3+
"dockerFile": "Dockerfile",
4+
"build": {"args": {"bashver": "4.3"}}
5+
}

tests/bats/.editorconfig

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
indent_style = space
6+
indent_size = 2
7+
insert_final_newline = true
8+
max_line_length = 80
9+
trim_trailing_whitespace = true
10+
11+
# The JSON files contain newlines inconsistently
12+
[*.json]
13+
indent_size = 2
14+
insert_final_newline = ignore
15+
16+
# YAML
17+
[*.{yml,yaml}]
18+
indent_style = space
19+
indent_size = 2
20+
21+
# Makefiles always use tabs for recipe indentation
22+
[{Makefile,*.mak}]
23+
indent_style = tab
24+
25+
# Markdown
26+
[*.{md,rmd,mkd,mkdn,mdwn,mdown,markdown,litcoffee}]
27+
max_line_length = 80
28+
# tabs behave as if they were replaced by spaces with a tab stop of 4 characters
29+
tab_width = 4
30+
# trailing spaces indicates word wrap
31+
trim_trailing_spaces = false
32+
trim_trailing_whitespace = false
33+
34+
[test/fixtures/bats/*_no_shellcheck.bats]
35+
ignore = true

tests/bats/.gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto
2+
*.sh eol=lf
3+
libexec/* eol=lf
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: 'Priority: NeedsTriage, Type: Bug'
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
16+
1. Create example `file.bats` with following contents
17+
2. run `bats --foo file.bats`
18+
3. ...
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Environment (please complete the following information):**
24+
- Bats version [e.g. 1.4.0 or commit hash if applicable]
25+
- operating system (including version): [e.g. Linux (please name your distribution!), FreeBSD, MacOS]
26+
- `bash --version`: [e.g. 5.1]
27+
- Install method: [e.g. git submodule, distribution package manager, npm, homebrew, ...]
28+
29+
**Additional context**
30+
Add any other context about the problem here.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: 'Priority: NeedsTriage, Type: Enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context about the feature request here.

tests/bats/.github/dependabot.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: docker
4+
directory: /.devcontainer
5+
schedule:
6+
interval: daily
7+
labels:
8+
- docker
9+
- devcontainer
10+
- dependencies
11+
- no changelog
12+
13+
- package-ecosystem: github-actions
14+
directory: /
15+
schedule:
16+
interval: daily
17+
labels:
18+
- github-actions
19+
- dependencies
20+
- no changelog
21+
22+
- package-ecosystem: docker
23+
directory: /
24+
schedule:
25+
interval: daily
26+
labels:
27+
- docker
28+
- dependencies
29+
- no changelog
30+
31+
- package-ecosystem: pip
32+
directory: /docs/source
33+
schedule:
34+
interval: daily
35+
labels:
36+
- pip
37+
- dependencies
38+
- no changelog
39+
40+
- package-ecosystem: npm
41+
directory: /
42+
schedule:
43+
interval: daily
44+
labels:
45+
- npm
46+
- dependencies
47+
- no changelog
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/bash
2+
3+
get_pr_json() {
4+
curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/bats-core/bats-core/pulls/$1"
5+
}
6+
7+
PR_NUMBER="$1"
8+
LABEL="$2"
9+
10+
get_pr_json "$PR_NUMBER" | jq .labels[].name | grep "$LABEL"
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Codespell
3+
4+
on:
5+
push:
6+
branches: [master]
7+
pull_request:
8+
branches: [master]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
codespell:
15+
name: Check for spelling errors
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
21+
- name: Codespell
22+
uses: codespell-project/actions-codespell@94259cd8be02ad2903ba34a22d9c13de21a74461 # v2.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required,
6+
# PRs introducing known-vulnerable packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
name: 'Dependency Review'
10+
on: [pull_request]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
dependency-review:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: 'Checkout Repository'
20+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
21+
- name: 'Dependency Review'
22+
uses: actions/dependency-review-action@1360a344ccb0ab6e9475edef90ad2f46bf8003b1 # v3.0.6
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
release: { types: [published] }
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
npmjs:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
15+
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
16+
with:
17+
registry-url: "https://registry.npmjs.org"
18+
- run: npm publish --ignore-scripts
19+
env:
20+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
21+
22+
github-npm:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
packages: write
26+
steps:
27+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
28+
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
29+
with:
30+
registry-url: "https://npm.pkg.github.com"
31+
- name: scope package name as required by GitHub Packages
32+
run: npm init -y --scope ${{ github.repository_owner }}
33+
- run: npm publish --ignore-scripts
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release to docker hub
2+
3+
on:
4+
release: { types: [published] }
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Version to simulate for deploy'
9+
required: true
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
dockerhub:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
packages: write
19+
steps:
20+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
21+
22+
- id: version
23+
run: |
24+
EXPECTED_VERSION=${{ github.event.inputs.version }}
25+
TAG_VERSION=${GITHUB_REF#refs/tags/v} # refs/tags/v1.2.3 -> 1.2.3
26+
echo ::set-output name=version::${EXPECTED_VERSION:-$TAG_VERSION}
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0
29+
30+
31+
- name: Login to DockerHub
32+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
33+
with:
34+
username: ${{ secrets.DOCKER_USERNAME }}
35+
password: ${{ secrets.DOCKER_PASSWORD }}
36+
37+
- name: Log in to the GitHub Container registry
38+
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Set up Docker Buildx
45+
id: buildx
46+
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1
47+
48+
- uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
49+
with:
50+
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
51+
tags: ${{ secrets.DOCKER_USERNAME }}/bats:${{ steps.version.outputs.version }},${{ secrets.DOCKER_USERNAME }}/bats:latest
52+
push: true
53+
54+
- uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
55+
with:
56+
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
57+
tags: ${{ secrets.DOCKER_USERNAME }}/bats:${{ steps.version.outputs.version }}-no-faccessat2,${{ secrets.DOCKER_USERNAME }}/bats:latest-no-faccessat2
58+
push: true
59+
build-args: bashver=5.1.4

0 commit comments

Comments
 (0)