Skip to content

Commit abfae6b

Browse files
authored
Add GitHub Actions for PR validation (#66)
1 parent 686547d commit abfae6b

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/build.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
if: github.repository == 'microsoft/sarif-tools'
11+
runs-on: ubuntu-latest
12+
name: Build
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.8'
23+
24+
- name: Install Poetry
25+
run: pip install poetry
26+
27+
- name: Poetry Build
28+
run: poetry build --no-interaction
29+
30+
- name: Get Verison
31+
id: get_version
32+
shell: bash
33+
run: echo "releaseVersion=$(poetry version --short)" >> $GITHUB_OUTPUT
34+
35+
- uses: actions/upload-artifact@v3
36+
with:
37+
name: wheel
38+
path: dist/sarif_tools-${{ steps.get_version.outputs.releaseVersion }}-py3-none-any.whl

.github/workflows/validation.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Validation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
hygiene:
13+
if: github.repository == 'microsoft/sarif-tools'
14+
runs-on: ubuntu-latest
15+
name: Hygiene
16+
permissions:
17+
contents: read
18+
pull-requests: write
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Setup Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: '3.8'
26+
27+
- name: Install Poetry
28+
run: pip install poetry
29+
30+
- name: Validate pyproject.toml and poetry.lock
31+
run: poetry check
32+
33+
test:
34+
if: github.repository == 'microsoft/sarif-tools'
35+
runs-on: ubuntu-latest
36+
name: Test
37+
steps:
38+
- uses: actions/checkout@v3
39+
40+
- name: Setup Python
41+
uses: actions/setup-python@v5
42+
with:
43+
python-version: '3.8'
44+
45+
- name: Install Poetry
46+
run: pip install poetry
47+
48+
- name: Install dependencies
49+
run: poetry install --with dev
50+
51+
- name: Run tests
52+
run: poetry run pytest

0 commit comments

Comments
 (0)