Update github actions #1416
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Swupd tests | |
on: [push, pull_request] | |
env: | |
RUNNING_IN_CI: true | |
NUM_JOBS: 10 | |
jobs: | |
formatting-check: | |
name: Formatting Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run clang-format style check | |
uses: jidicula/[email protected] | |
with: | |
clang-format-version: '16' | |
check-path: 'src' | |
unit_and_style: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build_dep | |
run: scripts/github_actions/build_ci_dependencies.bash | |
- name: build | |
run: scripts/github_actions/build_ci_style.bash | |
- name: check style | |
run: make compliant && make shellcheck && make docs-coverage | |
- name: check install | |
run: sudo make install && make install-check | |
- name: run unit tests | |
run: make check | |
- name: run distcheck | |
run: make distcheck | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
api: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: install_bats | |
run: sudo apt-get install bats | |
- name: api | |
run: test/code_analysis/check_api_changes.bats | |
test_job1: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
JOB_NUMBER: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build | |
run: | | |
scripts/github_actions/build_ci_dependencies.bash | |
scripts/github_actions/build_ci.bash | |
- name: run check | |
run: scripts/github_actions/run_check.bash "$JOB_NUMBER" "$NUM_JOBS" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: job-${{ env.JOB_NUMBER }} | |
path: job-${{ env.JOB_NUMBER }} | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
test_job2: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
JOB_NUMBER: 2 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build | |
run: | | |
scripts/github_actions/build_ci_dependencies.bash | |
scripts/github_actions/build_ci.bash | |
- name: run check | |
run: scripts/github_actions/run_check.bash "$JOB_NUMBER" "$NUM_JOBS" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: job-${{ env.JOB_NUMBER }} | |
path: job-${{ env.JOB_NUMBER }} | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
test_job3: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
JOB_NUMBER: 3 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build | |
run: | | |
scripts/github_actions/build_ci_dependencies.bash | |
scripts/github_actions/build_ci.bash | |
- name: run check | |
run: scripts/github_actions/run_check.bash "$JOB_NUMBER" "$NUM_JOBS" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: job-${{ env.JOB_NUMBER }} | |
path: job-${{ env.JOB_NUMBER }} | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
test_job4: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
JOB_NUMBER: 4 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build | |
run: | | |
scripts/github_actions/build_ci_dependencies.bash | |
scripts/github_actions/build_ci.bash | |
- name: run check | |
run: scripts/github_actions/run_check.bash "$JOB_NUMBER" "$NUM_JOBS" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: job-${{ env.JOB_NUMBER }} | |
path: job-${{ env.JOB_NUMBER }} | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
test_job5: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
JOB_NUMBER: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build | |
run: | | |
scripts/github_actions/build_ci_dependencies.bash | |
scripts/github_actions/build_ci.bash | |
- name: run check | |
run: scripts/github_actions/run_check.bash "$JOB_NUMBER" "$NUM_JOBS" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: job-${{ env.JOB_NUMBER }} | |
path: job-${{ env.JOB_NUMBER }} | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
test_job6: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
JOB_NUMBER: 6 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build | |
run: | | |
scripts/github_actions/build_ci_dependencies.bash | |
scripts/github_actions/build_ci.bash | |
- name: run check | |
run: scripts/github_actions/run_check.bash "$JOB_NUMBER" "$NUM_JOBS" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: job-${{ env.JOB_NUMBER }} | |
path: job-${{ env.JOB_NUMBER }} | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
test_job7: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
JOB_NUMBER: 7 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build | |
run: | | |
scripts/github_actions/build_ci_dependencies.bash | |
scripts/github_actions/build_ci.bash | |
- name: run check | |
run: scripts/github_actions/run_check.bash "$JOB_NUMBER" "$NUM_JOBS" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: job-${{ env.JOB_NUMBER }} | |
path: job-${{ env.JOB_NUMBER }} | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
test_job8: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
JOB_NUMBER: 8 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build | |
run: | | |
scripts/github_actions/build_ci_dependencies.bash | |
scripts/github_actions/build_ci.bash | |
- name: run check | |
run: scripts/github_actions/run_check.bash "$JOB_NUMBER" "$NUM_JOBS" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: job-${{ env.JOB_NUMBER }} | |
path: job-${{ env.JOB_NUMBER }} | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
test_job9: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
JOB_NUMBER: 9 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build | |
run: | | |
scripts/github_actions/build_ci_dependencies.bash | |
scripts/github_actions/build_ci.bash | |
- name: run check | |
run: scripts/github_actions/run_check.bash "$JOB_NUMBER" "$NUM_JOBS" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: job-${{ env.JOB_NUMBER }} | |
path: job-${{ env.JOB_NUMBER }} | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
test_job10: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
env: | |
JOB_NUMBER: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build | |
run: | | |
scripts/github_actions/build_ci_dependencies.bash | |
scripts/github_actions/build_ci.bash | |
- name: run check | |
run: scripts/github_actions/run_check.bash "$JOB_NUMBER" "$NUM_JOBS" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: job-${{ env.JOB_NUMBER }} | |
path: job-${{ env.JOB_NUMBER }} | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
test_only_ci: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: cache-dependencies | |
id: cache-swupd-deps | |
uses: actions/cache@v3 | |
with: | |
path: dependencies | |
key: swupd-dependencies | |
- name: build_dep | |
run: scripts/github_actions/build_ci_dependencies.bash | |
- name: build | |
run: scripts/github_actions/build_ci.bash | |
- name: run check slow | |
run: | | |
FILES="$(find test/functional/only_in_ci_slow/ -name "*.bats")" | |
env TESTS="$(echo $FILES)" make -e -j10 check | |
echo "$FILES" >> job-only-ci | |
- name: run check system | |
run: | | |
FILES="$(find test/functional/only_in_ci_system/ -name "*.bats")" | |
env TESTS="$(echo $FILES)" make -e -j1 check | |
echo "$FILES" >> job-only-ci | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: job-only-ci | |
path: job-only-ci | |
- name: print status | |
if: failure() | |
run: cat test-suite.log | |
test_successful: | |
runs-on: ubuntu-latest | |
needs: [unit_and_style, api, test_job1, test_job2, test_job3, test_job4, test_job5, test_job6, test_job7, test_job8, test_job9, test_job10, test_only_ci] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: job-1 | |
path: jobs/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: job-2 | |
path: jobs/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: job-3 | |
path: jobs/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: job-4 | |
path: jobs/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: job-5 | |
path: jobs/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: job-6 | |
path: jobs/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: job-7 | |
path: jobs/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: job-8 | |
path: jobs/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: job-9 | |
path: jobs/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: job-10 | |
path: jobs/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: job-only-ci | |
path: jobs/ | |
- name: Successful | |
run: | | |
find test/functional/ -name "*.bats" | sort -u > all_tests | |
cat jobs/job-* | sort -u > run_tests | |
diff -u all_tests run_tests |