-
Notifications
You must be signed in to change notification settings - Fork 15
176 lines (155 loc) · 4.7 KB
/
ci.yml
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: CI
on:
pull_request:
push:
branches:
- main
- rc/*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
os: [linux]
include:
- os: linux
runner: ubuntu-latest
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- id: stack
uses: freckle/stack-action@v5
- uses: freckle/weeder-action@v2
with:
ghc-version: ${{ steps.stack.outputs.compiler-version }}
- run: |
dist=restyler-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)
mkdir -p "$dist"
cp -v ${{ steps.stack.outputs.local-install-root }}/bin/* "$dist"
tar czf "$dist.tar.gz" "$dist"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-binaries
path: "restyler-*.tar.gz"
if-no-files-found: error
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/hlint-setup@v2
- uses: haskell-actions/hlint-run@v2
with:
fail-on: warning
commitlint:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 # need to get back to base
- uses: actions/setup-node@v4
- name: Install
run: |
npm install --save-dev @commitlint/cli
npm install --save-dev @commitlint/config-conventional
- name: Run
run: |
npx commitlint --from "$BASE_SHA" --to "$HEAD_SHA" --color
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
integration-test:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/download-artifact@v4
with:
name: linux-binaries
- run: |
tar xzf restyler-*.tar.gz
mkdir -p ./bin
sudo mv -v restyler-*/restyle /usr/local/bin
restyle --help
- uses: restyled-io/actions/setup-demo@v2
with:
options: --limit 3
- uses: restyled-io/actions/run@v2
with:
paths: .
log-level: debug
release:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- id: token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.AUTOMATION_APP_ID }}
private-key: ${{ secrets.AUTOMATION_PRIVATE_KEY }}
- id: release
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
- if: ${{ steps.release.outputs.new_release_published == 'true' }}
run: |
gh release upload "$TAG" ./*-binaries/restyler-*.tar.gz
env:
TAG: ${{ steps.release.outputs.new_release_git_tag }}
GH_TOKEN: ${{ github.token }}
docs:
#if: ${{ github.ref == 'refs/heads/main' }}
needs: [build]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: read
pages: write
id-token: write
runs-on: ubuntu-latest
steps:
- run: gem install --user ronn-ng
- run: |
for bin in ~/.local/share/gem/ruby/*/bin; do
echo "$bin"
done >>"$GITHUB_PATH"
- uses: actions/download-artifact@v4
with:
name: linux-binaries
- run: |
tar xzf restyler-*.tar.gz
mkdir -p ./bin
sudo mv -v restyler-*/restyle /usr/local/bin
# TODO: only checkout doc folder
- uses: actions/checkout@v4
- name: Generate ronn documenation
run: |
restyle __render-docs-man1__ > doc/restyle.1.ronn
restyle __render-docs-man5__ > doc/restyled.yaml.5.ronn
- name: Generate HTML sources to _site
run: |
env \
RONN_STYLE=./doc \
RONN_ORGANIZATION=Restyled \
RONN_MANUAL="Restyler v$(restyle --version | cut -d' ' -f 2)" \
ronn --style toc,custom --roff --html doc/*.ronn
mkdir -p _site/man-pages
cp -v doc/*.html _site/man-pages/
- uses: actions/upload-pages-artifact@v3
with:
path: _site
- id: deployment
uses: actions/deploy-pages@v4
test-install:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./install
- run: restyle --help