Skip to content

Commit c24e41e

Browse files
committed
ci: Also check whether all commits build
1 parent 8315589 commit c24e41e

File tree

1 file changed

+72
-1
lines changed

1 file changed

+72
-1
lines changed

.github/workflows/ci.yml

+72-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,77 @@ jobs:
4040
- name: Run cargo fmt
4141
run: cargo fmt --all -- --check
4242

43+
code-analysis:
44+
name: Code Analysis
45+
runs-on: ubuntu-latest
46+
container:
47+
image: bilelmoussaoui/flatpak-github-actions:gnome-45
48+
options: --privileged
49+
needs: [check-commit-style, typos, rustfmt]
50+
steps:
51+
- uses: actions/checkout@v3
52+
with:
53+
fetch-depth: 0
54+
55+
- name: Cache flatpak
56+
id: cache-flatpak
57+
uses: actions/cache@v3
58+
with:
59+
path: .flatpak-builder
60+
key: ${{ runner.os }}-flatpak-${{ hashFiles('build-aux/com.github.marhkb.Pods.Devel.json') }}
61+
restore-keys: ${{ runner.os }}-flatpak-
62+
63+
- name: Cache cargo
64+
id: cache-cargo
65+
uses: actions/cache@v3
66+
with:
67+
path: /github/home/.cargo
68+
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
69+
restore-keys: ${{ runner.os }}-cargo-
70+
71+
- name: Create dummy versions of configured file
72+
run: |
73+
sed \
74+
-e 's/str =.*;/str = "";/g' \
75+
-e 's/i32 =.*;/i32 = 0;/g' \
76+
src/config.rs.in \
77+
> src/config.rs
78+
79+
- name: Build dependencies
80+
run: |
81+
flatpak-builder \
82+
--disable-rofiles-fuse \
83+
--install-deps-from=flathub \
84+
--keep-build-dirs \
85+
--stop-at=pods \
86+
flatpak_app build-aux/com.github.marhkb.Pods.Devel.json
87+
88+
- name: Retrieve rustc version
89+
id: rustc-version
90+
run: |
91+
echo "RUSTC_VERSION=$(flatpak-builder --run flatpak_app build-aux/com.github.marhkb.Pods.Devel.json rustc -V)" >> $GITHUB_OUTPUT
92+
93+
- name: Cache target
94+
id: cache-target
95+
uses: actions/cache@v3
96+
with:
97+
path: target
98+
key: ${{ runner.os }}-target-${{ steps.rustc-version.outputs.RUSTC_VERSION }}-${{ hashFiles('Cargo.lock') }}
99+
restore-keys: ${{ runner.os }}-target-${{ steps.rustc-version.outputs.RUSTC_VERSION }}
100+
101+
- name: Test if all commits build
102+
run: |
103+
git config --global --add safe.directory /__w/pods/pods
104+
105+
for commit in $(git rev-list ${{ github.base_ref }}..${{ github.head_ref }}); do
106+
git checkout $commit
107+
108+
flatpak-builder \
109+
--run \
110+
flatpak_app build-aux/com.github.marhkb.Pods.Devel.json \
111+
cargo build
112+
done
113+
43114
flatpak:
44115
name: Flatpak
45116
runs-on: ubuntu-latest
@@ -51,7 +122,7 @@ jobs:
51122
arch: [x86_64]
52123
# Don't fail the whole workflow if one architecture fails
53124
fail-fast: false
54-
needs: [check-commit-style, typos, rustfmt]
125+
needs: [code-analysis]
55126
steps:
56127
- uses: actions/checkout@v4
57128
# Docker is required by the docker/setup-qemu-action which enables emulation

0 commit comments

Comments
 (0)