Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Also check whether all commits build #742

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading