Skip to content

Commit 785a50f

Browse files
committed
feat(ci): Add Build Action
1 parent 737313a commit 785a50f

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.github/workflows/build.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Build and Compile Extractor Pack
2+
3+
on:
4+
pull_request:
5+
branches: ["main", "develop"]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
packages: read
11+
pull-requests: read
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
test-folders: ["library-tests", "queries-tests"]
19+
steps:
20+
- name: "Checkout"
21+
uses: actions/checkout@v4
22+
23+
- name: "Check for changes"
24+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
25+
id: extractor-changes
26+
with:
27+
filters: |
28+
src:
29+
- 'extractor/**'
30+
- 'rust-toolchain.toml'
31+
- 'Cargo.*'
32+
33+
- name: "Download Extracter"
34+
if: steps.extractor-changes.outputs.src == 'false'
35+
env:
36+
GH_TOKEN: ${{ github.token }}
37+
GITHUB_REPOSITORY: ${{ github.repository }}
38+
run: |
39+
set -e
40+
41+
gh release list -L 1 -R "$GITHUB_REPOSITORY"
42+
43+
gh release download \
44+
-R "$GITHUB_REPOSITORY" \
45+
--clobber \
46+
--pattern 'extractor-bicep.tar.gz'
47+
48+
tar -zxf extractor-bicep.tar.gz
49+
50+
- name: "Set up Rust"
51+
uses: dtolnay/rust-toolchain@nightly
52+
if: steps.extractor-changes.outputs.src == 'true'
53+
54+
- name: "Build Extractor"
55+
if: steps.extractor-changes.outputs.src == 'true'
56+
env:
57+
GH_TOKEN: ${{ github.token }}
58+
run: |
59+
gh extensions install github/gh-codeql
60+
gh codeql set-version latest
61+
62+
./scripts/create-extractor-pack.sh
63+
64+
gh codeql resolve languages --format=json --search-path ./extractor-pack
65+
66+
- name: "Run Tests"
67+
env:
68+
GH_TOKEN: ${{ github.token }}
69+
run: |
70+
./scripts/run-tests.sh "ql/test/${{ matrix.test-folders }}"
71+
72+
docs:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v4
76+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
77+
id: changes
78+
with:
79+
filters: |
80+
src:
81+
- '**.md'
82+
# lint markdown
83+
- name: "Lint Markdown"
84+
if: steps.changes.outputs.src == 'true'
85+
run: |
86+
npm install -g markdownlint-cli
87+
markdownlint '**.md' --ignore node_modules --disable MD013

0 commit comments

Comments
 (0)