1111
1212jobs :
1313 changes :
14- runs-on : ubuntu-22 .04
14+ runs-on : ubuntu-24 .04
1515 timeout-minutes : 15
1616 outputs :
1717 any_modified : ${{ steps.filter.outputs.any_modified }}
1818 steps :
1919 - uses : actions/checkout@v4
20- - uses : tj-actions/changed-files@v41
21- id : filter
2220 with :
23- files_ignore : |
24- docs
25- LICENSE
26- **.md
21+ fetch-depth : 0 # Required to get full history
22+ # Using Git commands instead of tj-actions/changed-files
23+ - name : Get changed files
24+ id : filter
25+ run : |
26+ # grep will exit with non-zero if no matching pattern
27+ # but we are ok with that, so to prevent workflow failing
28+ # we set allow errors
29+ set +e
30+
31+ # Change the base commit depending on event type
32+ if [[ "${{ github.event_name }}" == "push" ]]; then
33+ # For push events
34+ if [[ -n "${{ github.event.before }}" ]]; then
35+ BASE_COMMIT="${{ github.event.before }}"
36+ else
37+ # For workflow dispatch, etc.
38+ git fetch origin main --depth=1
39+ BASE_COMMIT="origin/main"
40+ fi
41+ elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
42+ # For pull request events
43+ git fetch origin "${{ github.base_ref }}" --depth=1
44+ BASE_COMMIT="origin/${{ github.base_ref }}"
45+ else
46+ # For workflow dispatch events
47+ git fetch origin main --depth=1
48+ BASE_COMMIT="HEAD~1"
49+ fi
50+
51+ echo "Using base commit: $BASE_COMMIT"
52+
53+ # Get changed files and filter out the ones to ignore
54+ ALL_CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT "$BASE_COMMIT" HEAD)
55+ FILTERED_FILES=$(echo "$ALL_CHANGED_FILES" | grep -v -E '^docs/|^LICENSE$|\.md$')
56+
57+ # Set the results
58+ if [[ -n "$FILTERED_FILES" ]]; then
59+ echo "any_modified=true" >> $GITHUB_OUTPUT
60+ echo "all_modified_files<<EOF" >> $GITHUB_OUTPUT
61+ echo "$FILTERED_FILES" >> $GITHUB_OUTPUT
62+ echo "EOF" >> $GITHUB_OUTPUT
63+ else
64+ echo "any_modified=false" >> $GITHUB_OUTPUT
65+ echo "all_modified_files=" >> $GITHUB_OUTPUT
66+ fi
2767 - name : List all changed files
2868 run : |
29- for file in ${{ steps.filter.outputs.all_modified_files }}; do
30- echo "$file was changed"
31- done
69+ if [[ "${{ steps.filter.outputs.any_modified }}" == "true" ]]; then
70+ echo "Changed files detected:"
71+ echo "${{ steps.filter.outputs.all_modified_files }}"
72+ else
73+ echo "No relevant changes detected"
74+ fi
3275
3376 check :
3477 needs : [changes]
3578 if : needs.changes.outputs.any_modified == 'true'
36- runs-on : ubuntu-22 .04
79+ runs-on : ubuntu-24 .04
3780 timeout-minutes : 15
3881 strategy :
3982 matrix :
@@ -48,24 +91,28 @@ jobs:
4891 - name : Install nightly rustfmt
4992 run : rustup toolchain install nightly --component rustfmt --profile minimal --no-self-update
5093 - name : typos-action
51- uses : crate-ci/typos@v1.22.9
94+ uses : crate-ci/typos@v1.32.0
5295 - name : Install just
5396 uses : taiki-e/install-action@just
5497 - name : Install cross-rs
55- run : cargo install cross --git https://github.com/cross-rs/cross
98+ run : RUSTFLAGS="" cargo install cross --git https://github.com/cross-rs/cross
5699 - name : Setup target
57100 run : |
58101 echo "CARGO=cross" >> ${GITHUB_ENV}
59102 echo "TARGET=${{ matrix.arch }}-unknown-linux-${{ matrix.libc }}" >> ${GITHUB_ENV}
60103 - name : Check formatting and lints
61104 run : just lint
105+ - name : Install cargo machete
106+ uses : taiki-e/install-action@v2
107+ with :
108+ tool : cargo-machete@0.7.0
62109 - name : Check unused deps
63- uses : bnjbvr/ cargo- machete@v0.7.0
110+ run : cargo machete
64111
65112 tests :
66113 needs : [changes]
67114 if : needs.changes.outputs.any_modified == 'true'
68- runs-on : ubuntu-22 .04
115+ runs-on : ubuntu-24 .04
69116 timeout-minutes : 20
70117 strategy :
71118 matrix :
@@ -78,11 +125,17 @@ jobs:
78125 - name : Install just
79126 uses : taiki-e/install-action@just
80127 - name : Install cross-rs
81- run : cargo install cross --git https://github.com/cross-rs/cross
82- - name : Setup target
128+ run : RUSTFLAGS="" cargo install cross --git https://github.com/cross-rs/cross
129+ - name : Create test user
130+ # Create user and home directory for tests that require them
131+ run : sudo useradd -m -d /tmp/testuser testuser
132+ - name : Setup environment variables
83133 run : |
84134 echo "CARGO=cross" >> ${GITHUB_ENV}
85135 echo "TARGET=${{ matrix.arch }}-unknown-linux-${{ matrix.libc }}" >> ${GITHUB_ENV}
136+ echo "TEST_NON_ROOT_UID=$(id -u testuser)" >> ${GITHUB_ENV}
137+ - name : Disable AppArmor restrictions
138+ run : echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
86139 - name : Run tests
87140 run : just test-basic
88141 - name : Run feature tests
94147 # coverage:
95148 # needs: [changes]
96149 # if: needs.changes.outputs.any_modified == 'true'
97- # runs-on: ubuntu-22 .04
150+ # runs-on: ubuntu-24 .04
98151 # timeout-minutes: 20
99152 # name: Run test coverage
100153 # steps:
0 commit comments