Skip to content

Commit ba6b001

Browse files
committed
ci: Fix failure
1 parent 7bf010b commit ba6b001

File tree

7 files changed

+79
-36
lines changed

7 files changed

+79
-36
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
indent_style = tab
33
indent_size = 3
44

5+
[*.yml]
6+
indent_style = space
7+
indent_size = 2
8+
59
[*.md]
610
indent_style = space
711
indent_size = 2

.github/workflows/ci.yml

Lines changed: 62 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,97 @@
1-
name: CI
1+
name: 'ci'
22

33
on:
44
push:
5-
branches: [ main, fix-ci ]
5+
branches: [main, dev, ci/*]
66
pull_request:
7-
branches: [ main, fix-ci ]
7+
branches: [main, dev, ci/*]
8+
9+
permissions: read-all
10+
11+
# env:
12+
13+
defaults:
14+
run:
15+
shell: bash
16+
working-directory: ./
817

918
jobs:
10-
build-linux:
19+
test-linux:
20+
name: 'Linux Test'
1121
strategy:
22+
fail-fast: false
1223
matrix:
13-
bashver: ["4.3", "4.4", "5.0", "latest"]
24+
os: ['ubuntu-20.04'] # ubuntu-18.04, ubuntu-20.04, ubuntu-latest
25+
bash-version: ['4.3', '4.4', '5.0', 'latest']
1426

15-
runs-on: ubuntu-latest
27+
runs-on: '${{ matrix.os }}'
1628

1729
steps:
18-
- uses: actions/checkout@v2
30+
- name: Checkout repository
31+
uses: actions/checkout@v2
1932
with:
2033
submodules: true
2134

22-
- name: Install dependencies
35+
- name: Install Bats
2336
run: |
24-
wget --no-check-certificate -O bats.tar.gz https://github.com/bats-core/bats-core/archive/v1.3.0.tar.gz
25-
mkdir bats
26-
tar --strip-components=1 -xvzf bats.tar.gz -C bats
37+
subdir='.workflow-data'
38+
bats_version='1.3.0'
39+
40+
curl -LsSo "$subdir/bats-core.tar.gz" --create-dirs \
41+
https://github.com/bats-core/bats-core/archive/v$bats_version.tar.gz
42+
tar --extract --transform "s,bats-core-$bats_version,bats-core," -C "$subdir" -f "$subdir/bats-core.tar.gz"
2743
2844
- name: Build image
2945
run: |
30-
docker build --build-arg bashver=${{ matrix.bashver }} --tag bpm/bpm:bash-${{ matrix.bashver }} .
31-
docker run bash:${{ matrix.bashver }} --version
46+
docker build \
47+
--build-arg bash_version=${{ matrix.bash-version }} \
48+
--tag bpm:bash-${{ matrix.bash-version }} \
49+
.
3250
3351
- name: Run tests
3452
run: |
35-
time docker run bpm/bpm:bash-${{ matrix.bashver }} --tap /opt/bpm/tests
53+
time docker run bpm:bash-${{ matrix.bash-version }} \
54+
--tap tests
55+
56+
test-mac:
57+
name: 'MacOS Test'
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
os: ['macos-10.15'] # macos-10.15, macos-11, macos-latest
3662

37-
build-mac:
38-
runs-on: macos-latest
63+
runs-on: '${{ matrix.os }}'
3964

4065
steps:
41-
- uses: actions/checkout@v2
66+
- uses: 'actions/checkout@v2'
4267
with:
4368
submodules: true
69+
path: 'source'
4470

45-
- name: Install dependencies
71+
- name: Install Prerequisites
4672
run: |
47-
wget --no-check-certificate -O bats.tar.gz https://github.com/bats-core/bats-core/archive/v1.3.0.tar.gz
48-
mkdir bats
49-
tar --strip-components=1 -xvzf bats.tar.gz -C bats
73+
brew install bash coreutils gnu-tar
5074
51-
brew install bash coreutils
75+
- name: Install Bats
76+
run: |
77+
subdir='.workflow-data'
78+
bats_version='1.3.0'
79+
80+
cd source
81+
82+
curl -LsSo "$subdir/bats-core.tar.gz" --create-dirs \
83+
https://github.com/bats-core/bats-core/archive/v$bats_version.tar.gz
84+
gtar --extract --transform "s,bats-core-$bats_version,bats-core," -C "$subdir" -f "$subdir/bats-core.tar.gz"
5285
5386
- name: Run tests
5487
run: |
88+
subdir='.workflow-data'
89+
90+
cd source
91+
5592
bash --version
5693
git config --global user.email "user@example.com"
5794
git config --global user.name "User Name"
58-
time bats/bin/bats --tap tests
95+
printf "%s\n" "---"
96+
97+
time "./$subdir/bats-core/bin/bats" --tap tests

.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

Doc

Whitespace-only changes.

Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
ARG bashver=latest
1+
ARG bash_version
22

3-
FROM bash:${bashver}
3+
FROM bash:${bash_version}
44

5-
RUN apk add --no-cache git; \
6-
git config --global user.email "user@example.com"; \
7-
git config --global user.name "User Name";
5+
RUN apk add --no-cache git \
6+
&& git config --global user.email "user@example.com" \
7+
&& git config --global user.name "User Name"
88

9-
COPY . /opt/bpm/
9+
COPY . /opt/bpm/source
1010

11-
ENTRYPOINT ["bash", "/opt/bpm/bats/bin/bats"]
11+
WORKDIR /opt/bpm/source
12+
ENTRYPOINT ["/opt/bpm/source/.workflow-data/bats-core/bin/bats"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ bpm add rupa/z tj/git-extras aristocratos/bashtop JosefZIla/bash2048
1515
This symlinks all executable scripts to a common directory. It does this for completion files and man pages as well
1616

1717
```sh
18-
$ ls -l --color=always ~/.local/share/bpm/cellar/bin/
18+
$ ls -l ~/.local/share/bpm/cellar/bin/
1919
... bash2048.sh -> /home/edwin/.local/share/bpm/cellar/packages/github.com/JosefZIla/bash2048/bash2048.sh
2020
... bashtop -> /home/edwin/.local/share/bpm/cellar/packages/github.com/aristocratos/bashtop/bashtop
2121
... git-alias -> /home/edwin/.local/share/bpm/cellar/packages/github.com/tj/git-extras/bin/git-alias
@@ -58,4 +58,4 @@ Why not use `bpkg` or `Basher`? Because `bpm`...
5858
- More flexibly parses command line arguments (basher)
5959
- Install local directories as packages (bpkg)
6060

61-
I I forked Basher because it had an excellent test suite and its behavior for installing packages made more sense to me, compared to `bpkg`
61+
I forked Basher because it had an excellent test suite and its behavior for installing packages made more sense to me, compared to `bpkg`

tests/util/test_util.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ test_util.get_bpm_root() {
66
if ! REPLY="$(
77
while [[ ! -d ".git" && "$PWD" != / ]]; do
88
if ! cd ..; then
9-
printf "%s\n" "Error: Could not cd to BPM directory"
9+
printf "%s\n" "Error: Could not cd to BPM directory" >&2
1010
exit 1
1111
fi
1212
done
1313
1414
if [[ $PWD == / ]]; then
15-
printf "%s\n" "Error: Could not find root BPM directory"
15+
printf "%s\n" "Error: Could not find root BPM directory" >&2
1616
exit 1
1717
fi
1818
1919
# BPM root is the parent directory of 'source', which holds
2020
# the Git repository
2121
if ! cd ..; then
22-
printf "%s\n" "Error: Could not cd to BPM directory"
22+
printf "%s\n" "Error: Could not cd to BPM directory" >&2
2323
exit 1
2424
fi
2525
printf "%s" "$PWD"

0 commit comments

Comments
 (0)