Skip to content

Commit 87d515a

Browse files
committed
CI: Add CodeQL
1 parent 3959519 commit 87d515a

4 files changed

Lines changed: 64 additions & 5 deletions

File tree

.github/workflows/codecov.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
push:
66
branches: [main]
77

8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
812
jobs:
913
codecov:
1014
runs-on: ubuntu-latest

.github/workflows/codeql.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches: [main, "version-*"]
6+
pull_request:
7+
branches: [main, "version-*"]
8+
schedule:
9+
- cron: "0 0 * * *"
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
security-events: write
17+
packages: read
18+
actions: read
19+
contents: read
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
- language: actions
26+
build-mode: none
27+
- language: python
28+
build-mode: none
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
- name: Initialize CodeQL
35+
uses: github/codeql-action/init@v3
36+
with:
37+
languages: ${{ matrix.language }}
38+
build-mode: ${{ matrix.build-mode }}
39+
40+
- name: Perform CodeQL Analysis
41+
uses: github/codeql-action/analyze@v3
42+
with:
43+
category: "/language:${{matrix.language}}"

.github/workflows/fmu-tools.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@ on:
1414
# Run CI every night and check that tests are working with latest dependencies
1515
- cron: "0 0 * * *"
1616

17+
permissions: {}
18+
1719
jobs:
1820
fmu-tools:
1921
runs-on: ubuntu-latest
2022
strategy:
2123
matrix:
2224
python-version: ["3.9", "3.10", "3.11", "3.12"]
2325

26+
permissions:
27+
contents: write # For docs
28+
pull-requests: write
2429
steps:
2530
- name: Checkout
2631
uses: actions/checkout@v4
@@ -72,7 +77,7 @@ jobs:
7277
7378
- name: Update GitHub pages
7479
if: |
75-
github.repository_owner == 'equinor' && github.ref == 'refs/heads/main' &&
80+
github.repository_owner == 'equinor' && github.ref == 'refs/heads/main' &&
7681
matrix.python-version == '3.11'
7782
run: |
7883
cp -R ./build/docs/html ../html
@@ -96,6 +101,9 @@ jobs:
96101
name: ${{ matrix.config.name }}
97102
runs-on: ${{ matrix.config.os }}
98103
timeout-minutes: 15
104+
permissions:
105+
contents: read
106+
pull-requests: write
99107
strategy:
100108
fail-fast: false
101109
matrix:

.github/workflows/fmutools-publish-pypi.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
release:
77
types: [published]
88

9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
913
jobs:
1014
build-n-publish:
1115
name: Build and publish Python 🐍 distributions 📦 to PyPI
@@ -28,15 +32,15 @@ jobs:
2832

2933
- name: Update pip
3034
run: pip install pip --upgrade
31-
35+
3236
- name: Install build dependencies
3337
run: pip install build --upgrade
34-
38+
3539
- name: Build package
3640
run: python -m build
37-
41+
3842
- uses: pypa/gh-action-pypi-publish@release/v1
3943
with:
4044
skip-existing: true
4145
verbose: true
42-
46+

0 commit comments

Comments
 (0)