Skip to content

Commit 88692b7

Browse files
authored
Merge pull request #352 from abhinavagarwal07/ci-hygiene
ci: harden workflow with SHA pins, permissions, timeouts, and dependabot
2 parents cc14ae1 + 035dcde commit 88692b7

2 files changed

Lines changed: 55 additions & 13 deletions

File tree

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
groups:
8+
github-actions:
9+
patterns:
10+
- "*"

.github/workflows/build-ubuntu.yml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,77 @@ on:
77
workflow_dispatch: # this is a nice option that will enable a button w/ inputs
88
inputs:
99
git-ref:
10-
description: Git Ref (Optional)
10+
description: Git Ref (Optional)
1111
required: false
12+
13+
permissions:
14+
contents: read
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
18+
cancel-in-progress: true
19+
1220
jobs:
1321
build-and-test:
1422
name: Build and test
15-
runs-on: ubuntu-latest
23+
runs-on: ubuntu-24.04
24+
timeout-minutes: 30
1625
steps:
1726
- name: Checkout code
18-
uses: actions/checkout@v4
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1928

20-
- uses: actions/setup-python@v4
29+
- name: Set up Python
30+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
31+
with:
32+
python-version: '3.12'
2133

2234
- name: Install build dependencies
2335
run: |
2436
sudo apt-get update
25-
sudo apt-get install valgrind gcc ninja-build meson libglib2.0-dev libfuse3-dev
37+
sudo apt-get install -y valgrind gcc ninja-build libglib2.0-dev libfuse3-dev openssh-server openssh-client fuse3
38+
39+
- name: Check FUSE availability
40+
run: |
41+
test -e /dev/fuse
42+
command -v fusermount3
2643
2744
- name: Install meson
28-
run: pip3 install meson pytest
45+
run: pip3 install meson pytest pytest-timeout
2946

3047
- name: build
3148
run: |
32-
mkdir build; cd build
33-
meson ..
34-
ninja
49+
meson setup build
50+
ninja -C build
3551
3652
# cd does not persist across steps
3753
- name: upload build artifact
38-
uses: actions/upload-artifact@v4
54+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
3955
with:
4056
name: sshfs
4157
path: build/sshfs
58+
if-no-files-found: ignore
4259

43-
- name: make ssh into localhost without prompt possible for tests
60+
- name: Setup SSH
4461
run: |
45-
ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N ""
62+
mkdir -p ~/.ssh
63+
chmod 700 ~/.ssh
64+
ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N ""
4665
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
66+
chmod 600 ~/.ssh/authorized_keys
67+
sudo systemctl start ssh || sudo service ssh start
68+
ssh -o StrictHostKeyChecking=no -o BatchMode=yes localhost true
4769
4870
- name: run tests
4971
run: |
5072
cd build
51-
python3 -m pytest test/
73+
python3 -m pytest test/ --timeout=300 --junitxml=test-results.xml --maxfail=99
74+
timeout-minutes: 20
75+
76+
- name: upload test results
77+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
78+
if: always()
79+
with:
80+
name: test-results
81+
path: |
82+
build/test-results.xml
83+
build/meson-logs/

0 commit comments

Comments
 (0)