Skip to content

Commit 75b47f3

Browse files
fix: praise be linters & fix test
Signed-off-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
1 parent 393af39 commit 75b47f3

File tree

5 files changed

+35
-31
lines changed

5 files changed

+35
-31
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
echo 'Setting up git'
5151
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
5252
git config --global user.name 'github-actions[bot]'
53+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
5354
git config pull.rebase false
5455
5556
echo 'Creating new branch'

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
],
77
"shellcheck.run": "onSave",
88
"shellcheck.customArgs": [
9-
"--shell=sh",
109
"--severity=style",
1110
"--extended-analysis=true",
1211
"--source-path=SCRIPTDIR",

test/lang-rust/lib.sh

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
1-
#! /bin/sh
1+
#! /usr/bin/env bash
22

33
# -----------------------------------------------
44
# ---- Source third-party libraries -----------
55
# -----------------------------------------------
66

77
# shellcheck source=/dev/null
8-
. dev-container-features-test-lib
8+
source dev-container-features-test-lib
99

1010
# shellcheck disable=SC2034
11-
readonly DATA_BASE_DIR='/opt/devcontainer/features/ghcr_io/georglauterbach'
11+
readonly DATA_BASE_DIR='/usr/local/share/dev_containers/features/ghcr_io/georglauterbach'
1212

1313
# -----------------------------------------------
1414
# ---- Assertions -----------------------------
1515
# -----------------------------------------------
1616

17-
__expect_failure() {
18-
sh -c "${*}" && return 1
17+
function __expect_failure() {
18+
bash -c "${*}" && return 1
1919
return 0
2020
}
2121

22-
assert_failure() {
23-
__TEST_NAME="${1:?Name of the test required}"
22+
function assert_failure() {
23+
local TEST_NAME="${1:?Name of the test required}"
2424
shift 1
2525

26-
check "expect::failure|${__TEST_NAME}" __expect_failure "${@}"
26+
check "expect::failure|${TEST_NAME}" __expect_failure "${@}"
2727
}
2828

29-
assert_success() {
30-
__TEST_NAME="${1:?Name of the test required}"
29+
function assert_success() {
30+
local TEST_NAME="${1:?Name of the test required}"
3131
shift 1
3232

33-
check "expect::success|${__TEST_NAME}" sh -c "${*}"
33+
check "expect::success|${TEST_NAME}" bash -c "${*}"
3434
}
3535

3636
# -----------------------------------------------
3737
# ---- Helper ---------------------------------
3838
# -----------------------------------------------
3939

40-
command_exists() {
40+
function command_exists() {
4141
assert_success "command::${1}" command -v "${1}"
4242
}
4343

44-
command_exists_not() {
44+
function command_exists_not() {
4545
assert_failure "command::${1}" command -v "${1}"
4646
}
4747

48-
dir_exists() {
49-
assert_success "directory::${1}" "[ -d \"${1}\" ]"
48+
function dir_exists() {
49+
assert_success "directory::${1}" "[[ -d ${1} ]]"
5050
}
5151

52-
dir_exists_not() {
53-
assert_failure "directory::${1}" "[ -d \"${1}\" ]"
52+
function dir_exists_not() {
53+
assert_failure "directory::${1}" "[[ -d ${1} ]]"
5454
}
5555

56-
file_exists() {
57-
assert_success "file::${1}" "[ -f \"${1}\" ]"
56+
function file_exists() {
57+
assert_success "file::${1}" "[[ -f ${1} ]]"
5858
}
5959

60-
file_exists_not() {
61-
assert_failure "file::${1}" "[ -f \"${1}\" ]"
60+
function file_exists_not() {
61+
assert_failure "file::${1}" "[[ -f ${1} ]]"
6262
}
6363

64-
env_is_set_with_value() {
65-
assert_success "env::set::${1}" "[ -v \"${1}\" ]"
66-
assert_success "env::set::${1}" "[ \"${1}\" = \"${2}\" ]"
64+
function env_is_set_with_value() {
65+
assert_success "env::set::${1}" "[[ -v ${1} ]]"
66+
assert_success "env::set::${1}" "[[ ${1} == ${2} ]]"
6767
}

test/lang-rust/test.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#! /bin/sh
1+
#! /bin/bash
22

3-
set -e -u
4-
. lib.sh
3+
set -eE -u -o pipefail
4+
shopt -s inherit_errexit
5+
6+
source lib.sh
57

68
assert_success :
79

test/lang-rust/ubuntu2404-basics.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#! /bin/sh
1+
#! /bin/bash
22

3-
set -e -u
4-
. lib.sh
3+
set -eE -u -o pipefail
4+
shopt -s inherit_errexit
5+
6+
source lib.sh
57

68
file_exists "${DATA_BASE_DIR}/rust/rustup/home/rustup-init"
79

0 commit comments

Comments
 (0)