Skip to content

Commit ed5e5a1

Browse files
authored
Merge pull request #16 from bash-bastion/ci
2 parents b202bbf + f1b3637 commit ed5e5a1

File tree

2 files changed

+203
-0
lines changed

2 files changed

+203
-0
lines changed

.github/workflows/site.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: 'Build and Deploy Site'
2+
on:
3+
push:
4+
branches-ignore: ['*-no-ci']
5+
pull_request:
6+
branches-ignore: ['*-no-ci']
7+
8+
permissions:
9+
contents: 'read'
10+
pages: 'write'
11+
id-token: 'write'
12+
13+
defaults:
14+
run:
15+
shell: 'bash'
16+
17+
# TODO
18+
# concurrency:
19+
# group: '${{ github.ref }}'
20+
# cancel-in-progress: true
21+
22+
jobs:
23+
build:
24+
runs-on: 'ubuntu-latest'
25+
steps:
26+
- uses: 'actions/checkout@v3'
27+
- run: |
28+
cat > mkdocs.yml <<EOF
29+
site_name: '${{ github.event.repository.name }}'
30+
site_url: 'https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}'
31+
repo_url: '${{ github.event.repository.url }}'
32+
# edit_uri: `edit/${settings.remoteBranchNameSource}/${settings.docsInputDir}/`
33+
# site_description: "" // TODO
34+
site_author: Edwin Kofler
35+
copyright: '© Edwin Kofler'
36+
# remote_branch: settings.remoteBranchName
37+
# remote_name: settings.remoteName
38+
docs_dir: './docs'
39+
site_dir: './output'
40+
EOF
41+
pipx run mkdocs build -f './mkdocs.yml'
42+
- uses: 'actions/upload-pages-artifact@v2'
43+
with:
44+
path: './output'
45+
deploy:
46+
environment:
47+
name: github-pages
48+
url: ${{ steps.deployment.outputs.page_url }}
49+
runs-on: ubuntu-latest
50+
needs: build
51+
steps:
52+
- id: deployment
53+
uses: actions/deploy-pages@v2

.github/workflows/test.yml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: 'Test'
2+
3+
on:
4+
push:
5+
branches-ignore: ['*-no-ci']
6+
pull_request:
7+
branches-ignore: ['*-no-ci']
8+
9+
permissions: 'read-all'
10+
11+
defaults:
12+
run:
13+
shell: 'bash'
14+
15+
# TODO
16+
# concurrency:
17+
# group: '${{ github.ref }}'
18+
# cancel-in-progress: true
19+
20+
jobs:
21+
test:
22+
name: 'Test Linux'
23+
runs-on: '${{ matrix.os }}'
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
os: ['ubuntu-latest']
28+
images:
29+
- 'debian:10'
30+
- 'debian:11'
31+
- 'debian:12'
32+
- 'ubuntu:20.04'
33+
- 'ubuntu:22.04'
34+
- 'fedora:37'
35+
- 'fedora:38'
36+
# - 'opensuse/leap:15.4'
37+
# - 'opensuse/leap:15.5'
38+
# - 'opensuse/tumbleweed:latest' # TODO
39+
- 'archlinux:latest'
40+
container:
41+
image: '${{ matrix.images }}'
42+
steps:
43+
- uses: 'step-security/harden-runner@v2' # TODO, step-security/secure-repo
44+
with:
45+
egress-policy: audit
46+
- name: 'Install Dependencies'
47+
run: |
48+
if command -v apt-get >/dev/null 2>&1; then
49+
DEBIAN_FRONTEND=noninteractive apt-get update -y
50+
DEBIAN_FRONTEND=noninteractive apt-get install -y curl git
51+
elif command -v dnf >/dev/null 2>&1; then
52+
dnf update -y
53+
dnf install -y curl git
54+
elif command -v zypper >/dev/null 2>&1; then
55+
zypper update -y
56+
zypper install -y tar curl git bash
57+
elif command -v pacman >/dev/null 2>&1; then
58+
pacman -Syu --noconfirm curl git
59+
fi
60+
- name: 'Install Basalt'
61+
run: |
62+
git clone https://github.com/hyperupcall/basalt "${XDG_DATA_HOME:-$HOME/.local/share}/basalt/source"
63+
PATH="${XDG_DATA_HOME:-$HOME/.local/share}/basalt/source/pkg/bin:$PATH"
64+
65+
mkdir -p /basalt
66+
printf '%s\n' "${{ github.token }}" > /basalt/token
67+
68+
eval "$(basalt global init bash)"
69+
(
70+
cd "${XDG_DATA_HOME:-$HOME/.local/share}/basalt/source"
71+
basalt install
72+
)
73+
74+
printf '%s\n' "${XDG_DATA_HOME:-$HOME/.local/share}/basalt/source/pkg/bin" >> "$GITHUB_PATH"
75+
- name: 'Install Bats'
76+
run: |
77+
subdir="$HOME/.tools"
78+
bats_version='1.4.1'
79+
80+
mkdir -p "$subdir"
81+
curl -LsSo "$subdir/bats-core.tar.gz" --create-dirs \
82+
https://github.com/bats-core/bats-core/archive/v$bats_version.tar.gz
83+
tar --extract --transform "s,bats-core-$bats_version,bats-core," -C "$subdir" -f "$subdir/bats-core.tar.gz"
84+
ls -al "$subdir/bats-core/bin"
85+
echo i am pwd: "$PWD"
86+
printf '%s\n' "$subdir/bats-core/bin" >> "$GITHUB_PATH"
87+
- uses: 'actions/checkout@v3'
88+
- name: 'Run Test'
89+
run: |
90+
git config --global user.email "[email protected]"
91+
git config --global user.name "User Name"
92+
93+
bash --version
94+
eval "$(basalt global init bash)"
95+
basalt install
96+
sleep 10
97+
touch .basalt/generated/done.sh
98+
time bats --tap tests
99+
# test-bats:
100+
# name: 'Test Bash versions'
101+
# runs-on: 'ubuntu-latest'
102+
# strategy:
103+
# fail-fast: false
104+
# matrix:
105+
# bash-version: ['4.3', '4.4', '5.0', '5.1', 'latest']
106+
# steps:
107+
# - run: echo 'thing'
108+
109+
# test-mac:
110+
# name: 'MacOS Test'
111+
# strategy:
112+
# fail-fast: false
113+
# matrix:
114+
# os: ['macos-latest']
115+
# runs-on: '${{ matrix.os }}'
116+
117+
# steps:
118+
# - uses: 'actions/checkout@v2'
119+
# with:
120+
# submodules: true
121+
# path: 'source'
122+
123+
# - name: Install Prerequisites
124+
# run: |
125+
# # gnu-tar is only for the 'Install Bats' step
126+
# brew install bash coreutils curl gnu-tar
127+
128+
# - name: Install Bats
129+
# run: |
130+
# subdir='.workflow-data'
131+
# bats_version='1.4.1'
132+
133+
# cd source
134+
135+
# curl -LsSo "$subdir/bats-core.tar.gz" --create-dirs \
136+
# https://github.com/bats-core/bats-core/archive/v$bats_version.tar.gz
137+
# gtar --extract --transform "s,bats-core-$bats_version,bats-core," -C "$subdir" -f "$subdir/bats-core.tar.gz"
138+
139+
# - name: Run tests
140+
# run: |
141+
# subdir='.workflow-data'
142+
143+
# cd source
144+
145+
# bash --version
146+
# git config --global user.email "[email protected]"
147+
# git config --global user.name "User Name"
148+
# printf "%s\n" "---"
149+
150+
# time "./$subdir/bats-core/bin/bats" --tap tests

0 commit comments

Comments
 (0)