Skip to content

Commit 209af44

Browse files
authored
ci: Use reusable workflows and fix tests (#17)
1 parent ed5e5a1 commit 209af44

File tree

10 files changed

+65
-449
lines changed

10 files changed

+65
-449
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
end_of_line = lf
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.{yaml,yml,md}]
11+
indent_style = space
12+
indent_size = 2
13+
quote_type = single

.github/workflows/lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 'Lint'
2+
3+
on:
4+
push:
5+
branches-ignore: ['*-no-ci']
6+
tags-ignore: ['*']
7+
8+
permissions:
9+
contents: 'read'
10+
pages: 'write'
11+
id-token: 'write'
12+
13+
jobs:
14+
bash:
15+
name: 'Bash'
16+
uses: 'fox-land/hyperupcall-action/.github/workflows/bash-lint.yml@main'

.github/workflows/site.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 8 additions & 142 deletions
Original file line numberDiff line numberDiff line change
@@ -3,148 +3,14 @@ name: 'Test'
33
on:
44
push:
55
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'
6+
tags-ignore: ['*']
147

15-
# TODO
16-
# concurrency:
17-
# group: '${{ github.ref }}'
18-
# cancel-in-progress: true
8+
permissions:
9+
contents: 'read'
10+
pages: 'write'
11+
id-token: 'write'
1912

2013
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
14+
bash:
15+
name: 'Bash'
16+
uses: 'fox-land/hyperupcall-action/.github/workflows/bash-test.yml@main'

.github/workflows/website.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: 'Website'
2+
3+
on:
4+
push:
5+
branches-ignore: ['*-no-ci']
6+
tags-ignore: ['*']
7+
8+
permissions:
9+
contents: 'read'
10+
pages: 'write'
11+
id-token: 'write'
12+
13+
jobs:
14+
build-and-deploy:
15+
name: 'Build And Deploy'
16+
uses: 'fox-land/hyperupcall-action/.github/workflows/website.yml@main'

0 commit comments

Comments
 (0)