Skip to content

Commit

Permalink
feat: Vendor bats-core 1.10.0
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Webb <dan.webb@damacus.io>
  • Loading branch information
damacus committed Nov 30, 2023
1 parent d4a9c12 commit 697edb3
Show file tree
Hide file tree
Showing 92 changed files with 9,729 additions and 1,223 deletions.
16 changes: 4 additions & 12 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
require "bundler/gem_tasks"
require "open-uri"

namespace :bats do
version = ENV.fetch("BATS_VERSION", "v0.4.0")
url = "https://github.com/sstephenson/bats/archive/#{version}.tar.gz"
version = ENV.fetch("BATS_VERSION", "v1.10.0")
url = "https://github.com/bats-core/bats-core/archive/refs/tags/#{version}.tar.gz"
tarball = "tmp/bats-#{version}.tar.gz"
vendor = "vendor/bats"

Expand All @@ -13,14 +12,7 @@ namespace :bats do
directory File.dirname(tarball)
directory vendor

file tarball => File.dirname(tarball) do |t|
src = open(url).binmode
dst = open(t.name, "wb")
IO.copy_stream(src, dst)
ensure
src.close
dst.close
end
sh "curl -s -L #{url} -o #{tarball}"

file "#{vendor}/VERSION.txt" => [vendor, tarball] do |t|
abs_tarball = File.expand_path(tarball)
Expand Down Expand Up @@ -51,4 +43,4 @@ task :stats do
sh "countloc -r features"
end

task default: %i{test quality}
task default: %i{test}
17 changes: 17 additions & 0 deletions vendor/bats/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ARG bashver=latest

FROM bash:${bashver}

# Install parallel and accept the citation notice (we aren't using this in a
# context where it make sense to cite GNU Parallel).
RUN echo "@edgecomm http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
apk update && \
apk add --no-cache parallel ncurses shellcheck@edgecomm && \
mkdir -p ~/.parallel && touch ~/.parallel/will-cite && \
curl -sSfL https://github.com/shenwei356/rush/releases/download/v0.5.0/rush_linux_amd64.tar.gz | tar xzf - -C /usr/local/bin && \
chmod +x /usr/local/bin/rush

RUN ln -s /opt/bats/bin/bats /usr/sbin/bats
COPY . /opt/bats/

ENTRYPOINT ["bash", "/usr/sbin/bats"]
5 changes: 5 additions & 0 deletions vendor/bats/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Bats core development environment",
"dockerFile": "Dockerfile",
"build": {"args": {"bashver": "4.3"}}
}
35 changes: 35 additions & 0 deletions vendor/bats/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
root = true

[*]
end_of_line = lf
indent_style = space
indent_size = 2
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

# The JSON files contain newlines inconsistently
[*.json]
indent_size = 2
insert_final_newline = ignore

# YAML
[*.{yml,yaml}]
indent_style = space
indent_size = 2

# Makefiles always use tabs for recipe indentation
[{Makefile,*.mak}]
indent_style = tab

# Markdown
[*.{md,rmd,mkd,mkdn,mdwn,mdown,markdown,litcoffee}]
max_line_length = 80
# tabs behave as if they were replaced by spaces with a tab stop of 4 characters
tab_width = 4
# trailing spaces indicates word wrap
trim_trailing_spaces = false
trim_trailing_whitespace = false

[test/fixtures/bats/*_no_shellcheck.bats]
ignore = true
30 changes: 30 additions & 0 deletions vendor/bats/.github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'Priority: NeedsTriage, Type: Bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Create example `file.bats` with following contents
2. run `bats --foo file.bats`
3. ...

**Expected behavior**
A clear and concise description of what you expected to happen.

**Environment (please complete the following information):**
- Bats version [e.g. 1.4.0 or commit hash if applicable]
- operating system (including version): [e.g. Linux (please name your distribution!), FreeBSD, MacOS]
- `bash --version`: [e.g. 5.1]
- Install method: [e.g. git submodule, distribution package manager, npm, homebrew, ...]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions vendor/bats/.github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'Priority: NeedsTriage, Type: Enhancement'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context about the feature request here.
10 changes: 10 additions & 0 deletions vendor/bats/.github/workflows/check_pr_label.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/bash

get_pr_json() {
curl -s -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/bats-core/bats-core/pulls/$1"
}

PR_NUMBER="$1"
LABEL="$2"

get_pr_json "$PR_NUMBER" | jq .labels[].name | grep "$LABEL"
30 changes: 30 additions & 0 deletions vendor/bats/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

Check warning on line 1 in vendor/bats/.github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

1:1 [document-start] missing document start "---"

on:

Check warning on line 3 in vendor/bats/.github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

3:1 [truthy] truthy value should be one of [false, true]
release: { types: [published] }
workflow_dispatch:

jobs:
npmjs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
registry-url: "https://registry.npmjs.org"
- run: npm publish --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

github-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
registry-url: "https://npm.pkg.github.com"
- name: scope package name as required by GitHub Packages
run: npm init -y --scope ${{ github.repository_owner }}
- run: npm publish --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54 changes: 54 additions & 0 deletions vendor/bats/.github/workflows/release_dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release to docker hub

Check warning on line 1 in vendor/bats/.github/workflows/release_dockerhub.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

1:1 [document-start] missing document start "---"

on:

Check warning on line 3 in vendor/bats/.github/workflows/release_dockerhub.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

3:1 [truthy] truthy value should be one of [false, true]
release: { types: [published] }

Check failure on line 4 in vendor/bats/.github/workflows/release_dockerhub.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

4:13 [braces] too many spaces inside braces

Check failure on line 4 in vendor/bats/.github/workflows/release_dockerhub.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

4:32 [braces] too many spaces inside braces
workflow_dispatch:
inputs:
version:

Check failure on line 7 in vendor/bats/.github/workflows/release_dockerhub.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

7:9 [indentation] wrong indentation: expected 6 but found 8
description: 'Version to simulate for deploy'
required: true

jobs:
dockerhub:

Check failure on line 12 in vendor/bats/.github/workflows/release_dockerhub.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

12:5 [indentation] wrong indentation: expected 2 but found 4
runs-on: ubuntu-latest

Check failure on line 13 in vendor/bats/.github/workflows/release_dockerhub.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

13:9 [indentation] wrong indentation: expected 6 but found 8
steps:
- uses: actions/checkout@v2

Check failure on line 15 in vendor/bats/.github/workflows/release_dockerhub.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

15:9 [indentation] wrong indentation: expected 10 but found 8

- id: version
run: |
EXPECTED_VERSION=${{ github.event.inputs.version }}
TAG_VERSION=${GITHUB_REF#refs/tags/v} # refs/tags/v1.2.3 -> 1.2.3
echo ::set-output name=version::${EXPECTED_VERSION:-$TAG_VERSION}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1


- name: Login to DockerHub
uses: docker/login-action@v1

Check failure on line 27 in vendor/bats/.github/workflows/release_dockerhub.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

27:39 [trailing-spaces] trailing spaces
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the GitHub Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6

Check failure on line 45 in vendor/bats/.github/workflows/release_dockerhub.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

45:81 [line-length] line too long (108 > 80 characters)
tags: ${{ secrets.DOCKER_USERNAME }}/bats:${{ steps.version.outputs.version }},${{ secrets.DOCKER_USERNAME }}/bats:latest

Check failure on line 46 in vendor/bats/.github/workflows/release_dockerhub.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

46:81 [line-length] line too long (133 > 80 characters)
push: true

- uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6
tags: ${{ secrets.DOCKER_USERNAME }}/bats:${{ steps.version.outputs.version }}-no-faccessat2,${{ secrets.DOCKER_USERNAME }}/bats:latest-no-faccessat2
push: true
build-args: bashver=5.1.4
72 changes: 72 additions & 0 deletions vendor/bats/.github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This workflow uses actions that are not certified by GitHub. They are provided
# by a third-party and are governed by separate terms of service, privacy
# policy, and support documentation.

name: Scorecard supply-chain security

Check warning on line 5 in vendor/bats/.github/workflows/scorecard.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

5:1 [document-start] missing document start "---"
on:

Check warning on line 6 in vendor/bats/.github/workflows/scorecard.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

6:1 [truthy] truthy value should be one of [false, true]
# For Branch-Protection check. Only the default branch is supported. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
branch_protection_rule:
# To guarantee Maintained check is occasionally updated. See
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '44 10 * * 6'
push:
branches: [ "master" ]

# Declare default permissions as read only.
permissions: read-all

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
# Needed to publish results and get a badge (see publish_results below).
id-token: write
# Uncomment the permissions below if installing in a private repository.
# contents: read
# actions: read

steps:
- name: "Checkout code"
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

Check warning on line 35 in vendor/bats/.github/workflows/scorecard.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

35:73 [comments] too few spaces before comment
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2

Check warning on line 40 in vendor/bats/.github/workflows/scorecard.yml

View workflow job for this annotation

GitHub Actions / lint-unit / yamllint

40:78 [comments] too few spaces before comment
with:
results_file: results.sarif
results_format: sarif
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecard on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
# repo_token: ${{ secrets.SCORECARD_TOKEN }}

# Public repositories:
# - Publish results to OpenSSF REST API for easy access by consumers
# - Allows the repository to include the Scorecard badge.
# - See https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories:
# - `publish_results` will always be set to `false`, regardless
# of the value entered here.
publish_results: true

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
with:
sarif_file: results.sarif
1 change: 1 addition & 0 deletions vendor/bats/.github/workflows/set_nounset.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set -u
Loading

0 comments on commit 697edb3

Please sign in to comment.