Skip to content

Commit d6d979c

Browse files
authored
πŸ’š Optimise CI (#184)
* docs(maintenance): πŸ“ Update repository documents. * ci(maintenance): πŸ’š Optimise workflows modified: .github/.markdownlint.yaml new file: .github/workflows/zsh-n.yml new file: .github/workflows/zunit.yml modified: .trunk/trunk.yaml Signed-off-by: Salvydas Lukosius <[email protected]>
1 parent 76cfe8e commit d6d979c

File tree

9 files changed

+148
-337
lines changed

9 files changed

+148
-337
lines changed

β€Ž.github/.markdownlint.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ line_length: false
88
spaces: false
99
url: false
1010
whitespace: false
11+
MD041: false

β€Ž.github/workflows/trunk.yml

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -4,114 +4,10 @@ on:
44
push:
55
branches: [main]
66
tags: ["v*.*.*"]
7-
paths:
8-
- "./lib/**"
9-
- "./zi.zsh"
107
pull_request:
118
types: [opened, synchronize]
129
workflow_dispatch:
1310

14-
concurrency:
15-
group: ${{ github.head_ref || github.run_id }}
16-
cancel-in-progress: true
17-
1811
jobs:
1912
check:
2013
uses: z-shell/.github/.github/workflows/trunk.yml@main
21-
with:
22-
get_dependencies: apt-get update && sudo apt-get install -yq zsh
23-
runs-on: ubuntu-latest
24-
25-
zsh-matrix:
26-
runs-on: ubuntu-latest
27-
outputs:
28-
matrix: ${{ steps.set-matrix.outputs.matrix }}
29-
steps:
30-
- name: ‡️ Check out code from GitHub
31-
uses: actions/checkout@v3
32-
- name: "Set matrix output"
33-
id: set-matrix
34-
run: |
35-
MATRIX="$(find . -type d -name 'doc' -prune -o -type f \( -iname '*.zsh' -o -iname '_zi' \) -print | jq -ncR '{"include": [{"file": inputs}]}')"
36-
echo "MATRIX=${MATRIX}" >&2
37-
echo "::set-output name=matrix::${MATRIX}"
38-
zsh-n:
39-
runs-on: ubuntu-latest
40-
needs: zsh-matrix
41-
strategy:
42-
fail-fast: false
43-
matrix: ${{ fromJSON(needs.zsh-matrix.outputs.matrix) }}
44-
steps:
45-
- name: ‡️ Check out code from GitHub
46-
uses: actions/checkout@v3
47-
- name: "⚑ Install dependencies"
48-
run: sudo apt-get update && sudo apt-get install -yq zsh
49-
- name: "⚑ zsh -n: ${{ matrix.file }}"
50-
env:
51-
ZSH_FILE: ${{ matrix.file }}
52-
run: |
53-
zsh -n "${ZSH_FILE}"
54-
- name: "⚑ zcompile ${{ matrix.file }}"
55-
env:
56-
ZSH_FILE: ${{ matrix.file }}
57-
run: |
58-
zsh -fc "zcompile ${ZSH_FILE}"
59-
rc=$?
60-
ls -al "${ZSH_FILE}.zwc"
61-
exit "$rc"
62-
63-
zunit-matrix:
64-
runs-on: ubuntu-latest
65-
outputs:
66-
matrix: ${{ steps.set-matrix.outputs.matrix }}
67-
steps:
68-
- uses: actions/checkout@v3
69-
with:
70-
token: ${{ secrets.GITHUB_TOKEN }}
71-
repository: "z-shell/zd"
72-
- name: "Set matrix output"
73-
id: set-matrix
74-
run: |
75-
builtin cd docker/tests
76-
MATRIX="$(ls -1 *.zunit | sed 's/.zunit$//' | jq -ncR '{"include": [{"file": inputs}]}')"
77-
echo "MATRIX=${MATRIX}" >&2
78-
echo "::set-output name=matrix::${MATRIX}"
79-
80-
zunit:
81-
runs-on: ubuntu-latest
82-
needs: zunit-matrix
83-
strategy:
84-
fail-fast: false
85-
matrix: "${{ fromJSON(needs.zunit-matrix.outputs.matrix) }}"
86-
steps:
87-
- name: Login to GitHub Container Registry
88-
uses: docker/login-action@v2
89-
with:
90-
registry: ghcr.io
91-
username: ${{ github.repository_owner }}
92-
password: ${{ secrets.GITHUB_TOKEN }}
93-
- uses: actions/checkout@v3
94-
with:
95-
repository: "z-shell/zd"
96-
token: ${{ secrets.GITHUB_TOKEN }}
97-
- run: command git clone --branch main --depth 1 -- https://github.com/z-shell/zi.git zi
98-
- name: "⚑ Install dependencies"
99-
run: |
100-
sudo apt-get update && sudo apt-get install -yq zsh
101-
mkdir bin
102-
curl -fsSL https://raw.githubusercontent.com/zdharma/revolver/v0.2.4/revolver > bin/revolver
103-
curl -fsSL https://raw.githubusercontent.com/zdharma/color/d8f91ab5fcfceb623ae45d3333ad0e543775549c/color.zsh > bin/color
104-
git clone https://github.com/zdharma/zunit.git zunit.git
105-
cd zunit.git
106-
./build.zsh
107-
cd ..
108-
mv ./zunit.git/zunit bin
109-
chmod u+x bin/{color,revolver,zunit}
110-
- name: "⚑ ZUnit: ${{ matrix.file }}"
111-
env:
112-
ZUNIT_TEST: ${{ matrix.file }}
113-
run: |
114-
echo "⚑ $ZUNIT_TEST" >&2
115-
export PATH="$PWD/bin:$PATH"
116-
export TERM=xterm-256color
117-
zunit --tap --verbose "docker/tests/${ZUNIT_TEST}.zunit"

β€Ž.github/workflows/zsh-n.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
name: "βœ… Zsh"
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ["v*.*.*"]
7+
paths: ["zi.zsh", "lib/**"]
8+
pull_request:
9+
paths: ["zi.zsh", "lib/**"]
10+
workflow_run:
11+
workflows:
12+
- "β­• Trunk"
13+
types:
14+
- completed
15+
branches: [main]
16+
workflow_dispatch:
17+
18+
concurrency:
19+
group: ${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
22+
jobs:
23+
zsh-matrix:
24+
runs-on: ubuntu-latest
25+
outputs:
26+
matrix: ${{ steps.set-matrix.outputs.matrix }}
27+
steps:
28+
- name: ‡️ Check out code from GitHub
29+
uses: actions/checkout@v3
30+
- name: "Set matrix output"
31+
id: set-matrix
32+
run: |
33+
MATRIX="$(find . -type d -name 'doc' -prune -o -type f \( -iname '*.zsh' -o -iname '_zi' \) -print | jq -ncR '{"include": [{"file": inputs}]}')"
34+
echo "MATRIX=${MATRIX}" >&2
35+
echo "::set-output name=matrix::${MATRIX}"
36+
37+
zsh-n:
38+
runs-on: ubuntu-latest
39+
needs: zsh-matrix
40+
strategy:
41+
fail-fast: false
42+
matrix: ${{ fromJSON(needs.zsh-matrix.outputs.matrix) }}
43+
steps:
44+
- name: ‡️ Check out code from GitHub
45+
uses: actions/checkout@v3
46+
- name: "⚑ Install dependencies"
47+
run: sudo apt update && sudo apt-get install -yq zsh
48+
- name: "⚑ zsh -n: ${{ matrix.file }}"
49+
env:
50+
ZSH_FILE: ${{ matrix.file }}
51+
run: |
52+
zsh -n "${ZSH_FILE}"
53+
- name: "⚑ zcompile ${{ matrix.file }}"
54+
env:
55+
ZSH_FILE: ${{ matrix.file }}
56+
run: |
57+
zsh -fc "zcompile ${ZSH_FILE}"; rc=$?
58+
ls -al "${ZSH_FILE}.zwc"; exit "$rc"

β€Ž.github/workflows/zunit.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
name: "♾️ ZUnit"
3+
4+
on:
5+
push:
6+
branches: [main]
7+
tags: ["v*.*.*"]
8+
paths:
9+
- "lib/zsh/install.zsh"
10+
- "lib/zsh/autoload.zsh"
11+
pull_request:
12+
paths:
13+
- "lib/zsh/install.zsh"
14+
- "lib/zsh/autoload.zsh"
15+
workflow_dispatch:
16+
17+
concurrency:
18+
group: ${{ github.head_ref || github.run_id }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
zunit-matrix:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
matrix: ${{ steps.set-matrix.outputs.matrix }}
26+
steps:
27+
- uses: actions/checkout@v3
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
repository: "z-shell/zd"
31+
- name: "Set matrix output"
32+
id: set-matrix
33+
run: |
34+
builtin cd docker/tests
35+
MATRIX="$(ls -1 *.zunit | sed 's/.zunit$//' | jq -ncR '{"include": [{"file": inputs}]}')"
36+
echo "MATRIX=${MATRIX}" >&2
37+
echo "::set-output name=matrix::${MATRIX}"
38+
39+
zunit:
40+
runs-on: ubuntu-latest
41+
needs: zunit-matrix
42+
strategy:
43+
fail-fast: false
44+
matrix: "${{ fromJSON(needs.zunit-matrix.outputs.matrix) }}"
45+
steps:
46+
- name: Login to GitHub Container Registry
47+
uses: docker/login-action@v2
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.repository_owner }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
- uses: actions/checkout@v3
53+
with:
54+
repository: "z-shell/zd"
55+
token: ${{ secrets.GITHUB_TOKEN }}
56+
- run: command git clone --branch main --depth 1 -- https://github.com/z-shell/zi.git zi
57+
- name: "⚑ Install dependencies"
58+
run: |
59+
sudo apt-get update && sudo apt-get install -yq zsh
60+
mkdir bin
61+
curl -fsSL https://raw.githubusercontent.com/zdharma/revolver/v0.2.4/revolver > bin/revolver
62+
curl -fsSL https://raw.githubusercontent.com/zdharma/color/d8f91ab5fcfceb623ae45d3333ad0e543775549c/color.zsh > bin/color
63+
git clone https://github.com/zdharma/zunit.git zunit.git
64+
cd zunit.git
65+
./build.zsh
66+
cd ..
67+
mv ./zunit.git/zunit bin
68+
chmod u+x bin/{color,revolver,zunit}
69+
- name: "⚑ ZUnit: ${{ matrix.file }}"
70+
env:
71+
ZUNIT_TEST: ${{ matrix.file }}
72+
run: |
73+
echo "⚑ $ZUNIT_TEST" >&2
74+
export PATH="$PWD/bin:$PATH"
75+
export TERM=xterm-256color
76+
zunit --tap --verbose "docker/tests/${ZUNIT_TEST}.zunit"

β€Ž.trunk/trunk.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ repo:
77
owner: z-shell
88
name: zi
99
lint:
10+
disabled:
11+
- svgo
1012
linters:
1113
- name: markdownlint
1214
command:
@@ -16,5 +18,5 @@ lint:
1618
1719
1820
19-
- prettier@2.6.2
21+
- prettier@2.7.0
2022

β€Ž.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"conventionalCommits.scopes": ["core", "docs", "general", "workspace"],
2+
"conventionalCommits.scopes": ["core", "maintenance", "misc", "test"],
33
"markdownlint.config": {
44
"extends": ".github/.markdownlint.yaml"
55
}

0 commit comments

Comments
Β (0)