-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (137 loc) · 4.49 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: CI
on:
push:
branches:
- "*"
jobs:
build:
runs-on: ubuntu-latest
outputs:
build-cache-primary-key: ${{ steps.save-build-cache.outputs.cache-primary-key }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: jdx/mise-action@v2
- name: Build
run: |
deno task build
- uses: actions/cache/save@v4
id: save-build-cache
with:
path: bootstrap/_build
key: build-${{ hashFiles('deno.lock', 'bootstrap/src/**') }}
test-linux:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/cache/restore@v4
with:
path: bootstrap/_build
key: ${{ needs.build.outputs.build-cache-primary-key }}
- name: "Workaround: Prepare ~/.local/share/chezmoi"
run: |
ln -s "$(pwd)" "$HOME/.local/share/chezmoi"
- name: Install dependencies
run: |
sudo apt install -y zsh
- name: Install goss
run: |
sudo curl -L https://github.com/goss-org/goss/releases/latest/download/goss-linux-amd64 -o /usr/local/bin/goss
sudo chmod +rx /usr/local/bin/goss
- name: Run test
run: |
./bootstrap/_build/bootstrap-x86_64-unknown-linux-gnu
# Run script twice to test idempotency
./bootstrap/_build/bootstrap-x86_64-unknown-linux-gnu
goss validate --format documentation
test-macos:
runs-on: macos-latest
needs: build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/cache/restore@v4
with:
path: bootstrap/_build
key: ${{ needs.build.outputs.build-cache-primary-key }}
- name: "Workaround: Prepare ~/.local/share/chezmoi"
run: |
ln -s "$(pwd)" "$HOME/.local/share/chezmoi"
- name: Install goss
run: |
sudo curl -L https://github.com/goss-org/goss/releases/latest/download/goss-darwin-amd64 -o /usr/local/bin/goss
sudo chmod +rx /usr/local/bin/goss
- name: Run test
run: |
./bootstrap/_build/boostrap-x86_64-apple-darwin
# Run script twice to test idempotency
./bootstrap/_build/boostrap-x86_64-apple-darwin
GOSS_USE_ALPHA=1 goss validate --format documentation
test-windows:
runs-on: windows-latest
needs: build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/cache/restore@v4
with:
path: bootstrap/_build
key: ${{ needs.build.outputs.build-cache-primary-key }}
- name: "Workaround: Prepare ~/.local/share/chezmoi"
run: |
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.local\share"
New-Item -ItemType SymbolicLink -Value (Get-Location) -Path "$env:USERPROFILE\.local\share\chezmoi"
- name: Run test
run: |
.\bootstrap\_build\bootstrap-x86_64-pc-windows-msvc.exe
# Run script twice to test idempotency
.\bootstrap\_build\bootstrap-x86_64-pc-windows-msvc.exe
test-static:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: jdx/mise-action@v2
- name: Install dependencies
run: sudo apt install -y zsh
- name: Run test
run: deno run -A ./test/static.ts
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
release:
needs:
[build, test-linux, test-macos, test-windows, test-static, actionlint]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: actions/cache/restore@v4
with:
path: bootstrap/_build
key: ${{ needs.build.outputs.build-cache-primary-key }}
- id: generate-version
run: |
echo "version=v$(date --utc '+%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.generate-version.outputs.version }}