Skip to content

Commit

Permalink
ci: Also check whether all commits build
Browse files Browse the repository at this point in the history
  • Loading branch information
marhkb committed Jan 2, 2024
1 parent 8315589 commit c24e41e
Showing 1 changed file with 72 additions and 1 deletion.
73 changes: 72 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,77 @@ jobs:
- name: Run cargo fmt
run: cargo fmt --all -- --check

code-analysis:
name: Code Analysis
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-45
options: --privileged
needs: [check-commit-style, typos, rustfmt]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Cache flatpak
id: cache-flatpak
uses: actions/cache@v3
with:
path: .flatpak-builder
key: ${{ runner.os }}-flatpak-${{ hashFiles('build-aux/com.github.marhkb.Pods.Devel.json') }}
restore-keys: ${{ runner.os }}-flatpak-

- name: Cache cargo
id: cache-cargo
uses: actions/cache@v3
with:
path: /github/home/.cargo
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-

- name: Create dummy versions of configured file
run: |
sed \
-e 's/str =.*;/str = "";/g' \
-e 's/i32 =.*;/i32 = 0;/g' \
src/config.rs.in \
> src/config.rs
- name: Build dependencies
run: |
flatpak-builder \
--disable-rofiles-fuse \
--install-deps-from=flathub \
--keep-build-dirs \
--stop-at=pods \
flatpak_app build-aux/com.github.marhkb.Pods.Devel.json
- name: Retrieve rustc version
id: rustc-version
run: |
echo "RUSTC_VERSION=$(flatpak-builder --run flatpak_app build-aux/com.github.marhkb.Pods.Devel.json rustc -V)" >> $GITHUB_OUTPUT
- name: Cache target
id: cache-target
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-target-${{ steps.rustc-version.outputs.RUSTC_VERSION }}-${{ hashFiles('Cargo.lock') }}
restore-keys: ${{ runner.os }}-target-${{ steps.rustc-version.outputs.RUSTC_VERSION }}

- name: Test if all commits build
run: |
git config --global --add safe.directory /__w/pods/pods
for commit in $(git rev-list ${{ github.base_ref }}..${{ github.head_ref }}); do
git checkout $commit
flatpak-builder \
--run \
flatpak_app build-aux/com.github.marhkb.Pods.Devel.json \
cargo build
done
flatpak:
name: Flatpak
runs-on: ubuntu-latest
Expand All @@ -51,7 +122,7 @@ jobs:
arch: [x86_64]
# Don't fail the whole workflow if one architecture fails
fail-fast: false
needs: [check-commit-style, typos, rustfmt]
needs: [code-analysis]
steps:
- uses: actions/checkout@v4
# Docker is required by the docker/setup-qemu-action which enables emulation
Expand Down

0 comments on commit c24e41e

Please sign in to comment.