mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-05-05 21:21:49 +02:00
CI: Only run CI on branch or pull request events, but not twice.
This commit is contained in:
parent
03b3c9eba8
commit
10b313cd8b
1 changed files with 45 additions and 5 deletions
50
.github/workflows/ci.yml
vendored
50
.github/workflows/ci.yml
vendored
|
@ -1,6 +1,8 @@
|
||||||
name: Tests
|
name: Tests
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
schedule:
|
schedule:
|
||||||
|
@ -24,7 +26,24 @@ concurrency:
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
should-run:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
run-workflow: ${{ steps.check.outputs.run-workflow }}
|
||||||
|
steps:
|
||||||
|
- id: check
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
|
||||||
|
echo "run-workflow=true" >> $GITHUB_OUTPUT
|
||||||
|
elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" != "refs/heads/main" ]]; then
|
||||||
|
echo "run-workflow=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "run-workflow=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
run-lint:
|
run-lint:
|
||||||
|
needs: should-run
|
||||||
|
if: needs.should-run.outputs.run-workflow == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: debian:bookworm
|
image: debian:bookworm
|
||||||
|
@ -43,6 +62,8 @@ jobs:
|
||||||
# This is already built daily by the "build.yml" file
|
# This is already built daily by the "build.yml" file
|
||||||
# But we also want to include this in the checks that run on each push.
|
# But we also want to include this in the checks that run on each push.
|
||||||
build-container-image:
|
build-container-image:
|
||||||
|
needs: should-run
|
||||||
|
if: needs.should-run.outputs.run-workflow == 'true'
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
@ -67,6 +88,8 @@ jobs:
|
||||||
python3 ./install/common/build-image.py
|
python3 ./install/common/build-image.py
|
||||||
|
|
||||||
download-tessdata:
|
download-tessdata:
|
||||||
|
needs: should-run
|
||||||
|
if: needs.should-run.outputs.run-workflow == 'true'
|
||||||
name: Download and cache Tesseract data
|
name: Download and cache Tesseract data
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
@ -91,7 +114,10 @@ jobs:
|
||||||
|
|
||||||
windows:
|
windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
needs: download-tessdata
|
needs:
|
||||||
|
- download-tessdata
|
||||||
|
- should-run
|
||||||
|
if: needs.should-run.outputs.run-workflow == 'true'
|
||||||
env:
|
env:
|
||||||
DUMMY_CONVERSION: 1
|
DUMMY_CONVERSION: 1
|
||||||
steps:
|
steps:
|
||||||
|
@ -121,7 +147,10 @@ jobs:
|
||||||
macOS:
|
macOS:
|
||||||
name: "macOS (${{ matrix.arch }})"
|
name: "macOS (${{ matrix.arch }})"
|
||||||
runs-on: ${{ matrix.runner }}
|
runs-on: ${{ matrix.runner }}
|
||||||
needs: download-tessdata
|
needs:
|
||||||
|
- download-tessdata
|
||||||
|
- should-run
|
||||||
|
if: needs.should-run.outputs.run-workflow == 'true'
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
@ -149,9 +178,12 @@ jobs:
|
||||||
run: poetry run make test
|
run: poetry run make test
|
||||||
|
|
||||||
build-deb:
|
build-deb:
|
||||||
|
needs:
|
||||||
|
- should-run
|
||||||
|
- build-container-image
|
||||||
|
if: needs.should-run.outputs.run-workflow == 'true'
|
||||||
name: "build-deb (${{ matrix.distro }} ${{ matrix.version }})"
|
name: "build-deb (${{ matrix.distro }} ${{ matrix.version }})"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build-container-image
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
@ -221,7 +253,10 @@ jobs:
|
||||||
install-deb:
|
install-deb:
|
||||||
name: "install-deb (${{ matrix.distro }} ${{ matrix.version }})"
|
name: "install-deb (${{ matrix.distro }} ${{ matrix.version }})"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build-deb
|
needs:
|
||||||
|
- build-deb
|
||||||
|
- should-run
|
||||||
|
if: needs.should-run.outputs.run-workflow == 'true'
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
@ -277,7 +312,10 @@ jobs:
|
||||||
build-install-rpm:
|
build-install-rpm:
|
||||||
name: "build-install-rpm (${{ matrix.distro }} ${{matrix.version}})"
|
name: "build-install-rpm (${{ matrix.distro }} ${{matrix.version}})"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build-container-image
|
needs:
|
||||||
|
- build-container-image
|
||||||
|
- should-run
|
||||||
|
if: needs.should-run.outputs.run-workflow == 'true'
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
distro: ["fedora"]
|
distro: ["fedora"]
|
||||||
|
@ -343,6 +381,8 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- build-container-image
|
- build-container-image
|
||||||
- download-tessdata
|
- download-tessdata
|
||||||
|
- should-run
|
||||||
|
if: needs.should-run.outputs.run-workflow == 'true'
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
|
Loading…
Reference in a new issue