-
Notifications
You must be signed in to change notification settings - Fork 84
184 lines (179 loc) · 5.28 KB
/
ci.yml
File metadata and controls
184 lines (179 loc) · 5.28 KB
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
177
178
179
180
181
182
183
184
name: CI
on:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
jobs:
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: ">=1.25"
- name: Install dependencies
run: make install/dev
# It duplicates running linter from pre-commit
# but as revive is set up differently, we want
# to make sure that `make lint` also works.
- name: Run lint from Makefile
run: make lint
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.1
build-and-test:
# Don't use make here as this job needs to be cross-platform.
runs-on: ${{ matrix.os }}
strategy:
matrix:
go: ["1.25"]
os: [ubuntu-latest, windows-latest]
name: Build and test with Go ${{ matrix.go }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Setup deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Setup Dagger (Linux only)
uses: dagger/dagger-for-github@v7
with:
version: "latest"
verb: core
args: "engine local-cache"
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Setup Rust (Linux only)
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
override: true
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Install babashka (Linux only)
run: |
curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install
chmod +x install
./install
rm install
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Setup Node version
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install rust-script
run: cargo install rust-script
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Install direnv
run: curl -fsSL https://direnv.net/install.sh | bash
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Build
run: |
go build -o runme main.go
./runme --version
- name: Test with coverage
uses: stateful/runme-action@v2
with:
workflows: ci-coverage
env:
NO_COLOR: true
FROM_CI: true
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Test without coverage (txtar)
uses: stateful/runme-action@v2
with:
workflows: ci-txtar
env:
NO_COLOR: true
FROM_CI: true
if: ${{ matrix.os == 'ubuntu-latest' }}
- name: Test
run: |
Set-Timezone -Id "UTC" -PassThru
make test
if: ${{ matrix.os == 'windows-latest' }}
- name: Upload coverage
uses: actions/upload-artifact@v4
if: ${{github.actor != 'dependabot[bot]' && matrix.os == 'ubuntu-latest'}}
with:
name: coverage
path: cover.out
if-no-files-found: error
- name: Debug Build
uses: stateful/vscode-server-action@v1
if: failure()
test-in-docker:
name: Test in Docker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Test
uses: stateful/runme-action@v2
with:
workflows: test-docker
build-and-parser-test:
name: Test parser against vast amount of Markdowns
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: ">=1.24"
- name: Setup & build
uses: stateful/runme-action@v2
with:
workflows: |
setup
build
- name: Test parser
uses: stateful/runme-action@v2
with:
workflows: |
ci-test-parser
timeout-minutes: 5
- name: Debug Build
uses: stateful/vscode-server-action@v1.1.0
if: failure()
# sonarcloud:
# if: ${{github.actor != 'dependabot[bot]'}}
# name: SonarCloud Analysis
# runs-on: ubuntu-latest
# needs: build-and-test
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Retrieve saved coverage
# uses: actions/download-artifact@v4
# with:
# name: coverage
# path: .
# - name: SonarCloud Scan
# uses: SonarSource/sonarcloud-github-action@v2.1.1
# # Skip this test if the PR is created from a fork.
# # If its created from a fork the PR won't be able to fetch the secrets so
# # the step will fail.
# if: github.event.pull_request.head.repo.full_name == github.repository
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}