Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix homebrew setup on ubuntu runners #8

Merged
merged 5 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
- name: Check out code
uses: actions/checkout@v4
- name: Install BATS
run: "[[ -f /usr/local/bin/bats ]] && brew unlink bats || true ; brew install bats-core"
run: "[[ -f /home/linuxbrew/.linuxbrew/bin/brew ]] && eval \"$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)\" || true ; [[ -f /usr/local/bin/bats ]] && brew unlink bats || true ; brew install bats-core"
- name: Run BATS tests
run: bats tests/
run: "[[ -f /home/linuxbrew/.linuxbrew/bin/brew ]] && eval \"$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)\" || true ; bats tests/"
test-on-container-debian-ubuntu:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
Expand All @@ -34,7 +34,8 @@ jobs:
container: ["ubuntu:22.04", "ubuntu:20.04", "ubuntu:18.04", "debian:12-slim", "debian:11-slim", "debian:10-slim"]
steps:
- name: Check out code
uses: actions/checkout@v4
# use v3 for glibc compatibility with ubuntu:18.04
uses: actions/checkout@v3
- name: Install dependencies and BATS
run: "apt-get update && apt-get install -y openssl curl file bats xxd"
- name: Run BATS tests
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ The format is based on [Keep a Changelog][kac] and this project adheres to [Sema

## Contributing

Pull requests are welcome. The unit tests are written with https://github.com/bats-core/bats-core. Make use of the excellent tool `shellcheck` (https://www.shellcheck.net/). Run with `shellcheck -x -a aws-micro`.
Pull requests are welcome. The unit tests are written with https://github.com/bats-core/bats-core. Run with `bats tests/`. Make use of the excellent tool `shellcheck` (https://www.shellcheck.net/). Run with `shellcheck -x -a aws-micro`.

## License

Expand Down
3 changes: 3 additions & 0 deletions s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ s3_ls() {
request_url="$(create_request_url "${service}" ls "${_arg_endpoint_url}" "${region}" "${bucket}" "${key}")"

if [[ "${_arg_no_sign_request}" = "on" ]]; then
# shellcheck disable=SC2086
${dryrun} curl ${curl_output} --fail "${request_url}" | "${formatter}"
else
headers=("host:$(get_host_from_request_url "$request_url")" "x-amz-content-sha256:${content_sha256}" "x-amz-date:${date}" "${security_token_header:-}")
Expand Down Expand Up @@ -95,9 +96,11 @@ Error: Invalid argument type" # or <S3Uri> <S3Uri> (not yet implemented)

if [[ "${_arg_no_sign_request}" = "on" ]]; then
if [[ "${http_method}" == "PUT" ]]; then
# shellcheck disable=SC2086
${dryrun} curl ${curl_output} --fail -X "${http_method}" "${request_url}" --data-binary "@${source}" -o /dev/null
echo "upload: ${source} to s3://${bucket}/${key}"
else
# shellcheck disable=SC2086
${dryrun} curl ${curl_output} --fail "${request_url}" -o "${destination}"
echo "download: ${source} to ${destination}"
fi
Expand Down
1 change: 1 addition & 0 deletions s3api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ s3api_create-bucket() {
request_url="$(create_request_url "${service}" "" "${_arg_endpoint_url}" "${region}" "${bucket}" "")"

if [[ "${_arg_no_sign_request}" = "on" ]]; then
# shellcheck disable=SC2086
${dryrun} curl ${curl_output} --fail -X "${http_method}" "${request_url}" -H "Content-Length: 0" -o /dev/null
else
headers=("host:$(get_host_from_request_url "$request_url")" "x-amz-content-sha256:${content_sha256}" "x-amz-date:${date}" "${security_token_header:-}")
Expand Down
1 change: 1 addition & 0 deletions sts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ sts_assume-role() {
content_sha256="$(sha256 "${body}")"

if [[ "${_arg_no_sign_request}" = "on" ]]; then
# shellcheck disable=SC2086
${dryrun} curl ${curl_output} --fail "${request_url}" --data "${body}"
else
headers=("host:$(get_host_from_request_url "$request_url")" "x-amz-date:${date}" "content-type:application/x-www-form-urlencoded;charset=utf-8" "${security_token_header:-}")
Expand Down
2 changes: 1 addition & 1 deletion utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ md5_base64() {

sha256_hmac() {
declare -r sig="$1"
openssl sha256 -mac HMAC -macopt "$sig" -hex | sed 's/.*(stdin)= //'
openssl sha256 -mac HMAC -sha256 -macopt "$sig" -hex | sed 's/.*(stdin)= //'
}

sha256() {
Expand Down