Skip to content

Commit 21c87f2

Browse files
committed
ci: Add hacky GitHub actions stuff
1 parent d475b18 commit 21c87f2

File tree

4 files changed

+128
-0
lines changed

4 files changed

+128
-0
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ end_of_line = lf
66
charset = utf-8
77
trim_trailing_whitespace = true
88
insert_final_newline = true
9+
10+
[*.yaml]
11+
indent_style = space
12+
indent_size = 2

.github/workflows/ci.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: 'ci'
2+
3+
on:
4+
push:
5+
branches: [main, dev, ci/*]
6+
pull_request:
7+
branches: [main, dev, ci/*]
8+
9+
permissions: read-all
10+
11+
jobs:
12+
test-linux:
13+
name: 'Linux Test'
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: ['ubuntu-20.04'] # ubuntu-18.04, ubuntu-20.04, ubuntu-latest
18+
# bash-version: ['4.3', '4.4', '5.0', 'latest']
19+
20+
runs-on: '${{ matrix.os }}'
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: 'actions/checkout@v2'
25+
26+
- name: Build image
27+
run: |
28+
docker build \
29+
--tag bash-object:bash-version \
30+
.
31+
32+
- name: Run tests
33+
run: |
34+
time docker run bash-object:bash-version \
35+
--tap tests
36+
37+
# FIXME
38+
# test-mac:
39+
# name: 'MacOS Test'
40+
# strategy:
41+
# fail-fast: false
42+
# matrix:
43+
# os: ['macos-10.15'] # macos-10.15, macos-11, macos-latest
44+
45+
# runs-on: '${{ matrix.os }}'
46+
47+
# steps:
48+
# - uses: 'actions/checkout@v2'
49+
# with:
50+
# submodules: true
51+
# path: 'source'
52+
53+
# - name: Install Prerequisites
54+
# run: |
55+
# # gnu-tar is only for the 'Install Bats' step
56+
# brew install bash coreutils curl gnu-tar
57+
58+
# - name: Install Bats
59+
# run: |
60+
# subdir='.workflow-data'
61+
# bats_version='1.4.1'
62+
63+
# cd source
64+
65+
# curl -LsSo "$subdir/bats-core.tar.gz" --create-dirs \
66+
# https://github.com/bats-core/bats-core/archive/v$bats_version.tar.gz
67+
# gtar --extract --transform "s,bats-core-$bats_version,bats-core," -C "$subdir" -f "$subdir/bats-core.tar.gz"
68+
69+
# - name: Run tests
70+
# run: |
71+
# subdir='.workflow-data'
72+
73+
# cd source
74+
75+
# bash --version
76+
# git config --global user.email "user@example.com"
77+
# git config --global user.name "User Name"
78+
# printf "%s\n" "---"
79+
80+
# time "./$subdir/bats-core/bin/bats" --tap tests

.prettierrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"useTabs": true,
3+
"semi": false,
4+
"singleQuote": true,
5+
"trailingComma": "all"
6+
}

Dockerfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# ARG bash_version
2+
# FROM bash:${bash_version}
3+
FROM ubuntu
4+
5+
ARG BATS_VERSION=1.4.1
6+
ARG USER=ops
7+
8+
# RUN apk add --no-cache git curl \
9+
# && git config --global user.email "user@example.com" \
10+
# && git config --global user.name "User Name" \
11+
# && adduser -D ${USER}
12+
RUN apt-get update \
13+
&& apt-get install -y git curl \
14+
&& git config --global user.email "user@example.com" \
15+
&& git config --global user.name "User Name" \
16+
&& adduser ${USER}
17+
18+
RUN rm -f /basalt.lock
19+
20+
USER ops
21+
WORKDIR /home/${USER}
22+
23+
# Install Basalt
24+
RUN curl -LsSo- https://raw.githubusercontent.com/hyperupcall/basalt/main/scripts/install.sh | sh
25+
26+
# Install bats-core
27+
RUN \
28+
curl -LsSo './bats-core.tar.gz' --create-dirs "https://github.com/bats-core/bats-core/archive/v${BATS_VERSION}.tar.gz" \
29+
&& tar xf './bats-core.tar.gz' \
30+
&& mv ./bats-core-*/ ./bats-core \
31+
&& rm -f './bats-core.tar.gz'
32+
33+
COPY --chown=$USER:$USER . ./bash-object
34+
35+
WORKDIR /home/$USER/bash-object
36+
37+
ENV PATH="/home/ops/.local/share/basalt/source/pkg/bin:$PATH"
38+
ENTRYPOINT ["bash", "-c", "eval \"$(basalt global init bash)\" && basalt install && /home/ops/bats-core/bin/bats ./tests"]

0 commit comments

Comments
 (0)