Files
NerixyzandGitHub bf71244ed0 ci: Harden actions and dependabot (a bit) (#7188)
To prevent issues from using GitHub actions and dependabot, I hardened
the workflows using [zizmor](https://docs.zizmor.sh/). There are still
77 open findings. I only applied the ones that are easy wins.

- Pin actions to a commit hash instead of tag - tags are not immutable
(see [`unpinned-uses`](https://docs.zizmor.sh/audits/#unpinned-uses))
- Disable `persist-credentials` on checkout - we don't need it (see
[`artipacked`](https://docs.zizmor.sh/audits/#artipacked))
- Set cooldown on dependabot updates (see
[`dependabot-cooldown`](https://docs.zizmor.sh/audits/#dependabot-cooldown)).
For our own packages, we can manually create PRs.

I left the docker images unpinned, because they're frequently updated,
but zizmor would like to see them pinned as well.

Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
2026-08-20 20:58:01 +00:00

97 lines
2.9 KiB
YAML

---
name: Test Ubuntu
on:
pull_request:
workflow_dispatch:
merge_group:
push:
branches:
- master
- main
env:
TWITCH_PUBSUB_SERVER_TAG: v1.0.12
HTTPBOX_TAG: v0.2.1
QT_QPA_PLATFORM: minimal
concurrency:
group: test-ubuntu-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: "Test Ubuntu"
runs-on: ubuntu-latest
container: ghcr.io/chatterino/chatterino2-build-ubuntu-26.04:latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: recursive
persist-credentials: false
- name: Create build directory (Ubuntu)
run: mkdir build-test
- name: Install dependencies
run: |
sudo apt update
sudo DEBIAN_FRONTEND=noninteractive apt -y --no-install-recommends install \
libbenchmark-dev gcovr gnupg
- name: Install httpbox
run: |
curl -L -o httpbox.tar.xz "https://github.com/Chatterino/httpbox/releases/download/${{ env.HTTPBOX_TAG }}/httpbox-x86_64-unknown-linux-gnu.tar.xz"
tar -xJf httpbox.tar.xz
mv ./httpbox-x86_64-unknown-linux-gnu/httpbox /usr/local/bin
working-directory: /tmp
- name: Build (Ubuntu)
run: |
cmake \
-DBUILD_TESTS=On \
-DBUILD_BENCHMARKS=On \
-DBUILD_APP=OFF \
-DCMAKE_PREFIX_PATH="$Qt6_DIR/lib/cmake" \
-DCHATTERINO_STATIC_QT_BUILD=On \
-DCHATTERINO_GENERATE_COVERAGE=On \
-DCMAKE_BUILD_TYPE=Debug \
..
cmake --build . -j $(nproc)
working-directory: build-test
- name: Download and extract Twitch PubSub Server Test
run: |
mkdir pubsub-server-test
curl -L -o pubsub-server.tar.gz "https://github.com/Chatterino/twitch-pubsub-server-test/releases/download/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/server-${{ env.TWITCH_PUBSUB_SERVER_TAG }}-linux-amd64.tar.gz"
tar -xzf pubsub-server.tar.gz -C pubsub-server-test
rm pubsub-server.tar.gz
cd pubsub-server-test
cd ..
- name: Test
timeout-minutes: 30
run: |
httpbox --port 9051 &
cd ../pubsub-server-test
./server 127.0.0.1:9050 127.0.0.1:9052 &
cd ../build-test
ctest --repeat until-pass:4 --output-on-failure
working-directory: build-test
- name: Run benchmark
timeout-minutes: 2
run: |
./bin/chatterino-benchmark --benchmark_min_time=1x
working-directory: build-test
- name: Upload coverage reports to Codecov
if: github.repository_owner == 'Chatterino'
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
plugins: gcov
fail_ci_if_error: true
verbose: true