ci: restore dependency-storing dockerfile
This commit is contained in:
parent
9052dd556a
commit
fe1796cfa7
4 changed files with 95 additions and 29 deletions
90
.github/workflows/ci.yml
vendored
90
.github/workflows/ci.yml
vendored
|
|
@ -3,51 +3,85 @@ name: CI
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
tags: [ '*' ]
|
||||||
|
paths-ignore: [ '*.md' ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
UBUNTU_DOCKERFILE: .github/workflows/ubuntu.dockerfile
|
||||||
|
|
||||||
jobs:
|
|
||||||
ci:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
permissions:
|
||||||
|
pull-requests: read
|
||||||
contents: read
|
contents: read
|
||||||
packages: read
|
packages: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
set-vars:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
- name: Get MSRV
|
with:
|
||||||
id: msrv
|
fetch-depth: 2
|
||||||
run: |
|
sparse-checkout: |
|
||||||
echo "msrv=$(
|
.github
|
||||||
awk '/^rust-version = "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+"$/ {
|
Cargo.toml
|
||||||
print substr($NF, 2, length($NF) - 2)
|
sparse-checkout-cone-mode: false
|
||||||
}' Cargo.toml)" >> "$GITHUB_OUTPUT"
|
- id: set-vars
|
||||||
- name: Set XDG_RUNTIME_DIR
|
run: ./.github/workflows/set-vars.sh ${GITHUB_REPOSITORY@L}
|
||||||
id: xrd
|
outputs:
|
||||||
run: echo "testdir=$PWD/test-xwls" >> "$GITHUB_OUTPUT"
|
msrv: ${{ steps.set-vars.outputs.msrv }}
|
||||||
- name: Install dependencies
|
should-build: ${{ steps.set-vars.outputs.should_build == 'true' && github.event_name == 'push' }}
|
||||||
run: |
|
container-path: ${{ steps.set-vars.outputs.container_path }}
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y xwayland clang libxcb1 libxcb-cursor0 libxcb-cursor-dev pkg-config libegl1
|
container-build:
|
||||||
env:
|
runs-on: ubuntu-latest
|
||||||
DEBIAN_FRONTEND: noninteractive
|
needs: set-vars
|
||||||
|
if: ${{ needs.set-vars.outputs.should-build == 'true' }}
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
id-token: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: docker/setup-buildx-action@v3
|
||||||
|
- uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
file: ${{ env.UBUNTU_DOCKERFILE }}
|
||||||
|
push: true
|
||||||
|
tags: ${{ needs.set-vars.outputs.container-path }}-ubuntu:latest
|
||||||
|
labels: org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
xwls-build-test:
|
||||||
|
needs: [container-build, set-vars]
|
||||||
|
if: ${{ always() && (needs.container-build.result == 'success' || needs.container-build.result == 'skipped') }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ needs.set-vars.outputs.container-path }}-ubuntu:latest
|
||||||
|
credentials:
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
- uses: dtolnay/rust-toolchain@master
|
- uses: dtolnay/rust-toolchain@master
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ steps.msrv.outputs.msrv }}
|
toolchain: ${{ needs.set-vars.outputs.msrv }}
|
||||||
components: clippy, rustfmt
|
components: clippy, rustfmt
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --all-targets --profile ci --locked --verbose
|
run: cargo build --all-targets --profile ci --locked --verbose
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: cargo test --profile ci --locked --verbose -- --test-threads 1 --nocapture
|
||||||
mkdir "$XDG_RUNTIME_DIR"
|
|
||||||
cargo test --profile ci --locked --verbose -- --test-threads 1 --nocapture
|
|
||||||
env:
|
|
||||||
XDG_RUNTIME_DIR: ${{ steps.xrd.outputs.testdir }}
|
|
||||||
- name: Format check
|
- name: Format check
|
||||||
run: cargo fmt --check
|
run: cargo fmt --check
|
||||||
- name: Clippy
|
- name: Clippy
|
||||||
run: cargo clippy --profile ci --locked --workspace --all-targets
|
run: cargo clippy --all-targets --profile ci --locked --workspace
|
||||||
|
|
|
||||||
23
.github/workflows/set-vars.sh
vendored
Executable file
23
.github/workflows/set-vars.sh
vendored
Executable file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
msrv=$(
|
||||||
|
awk '/^rust-version = "[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+"$/ {
|
||||||
|
print substr($NF, 2, length($NF) - 2)
|
||||||
|
}' Cargo.toml
|
||||||
|
)
|
||||||
|
if [ -z $msrv ]; then
|
||||||
|
printf "Could not determine Rust toolchain version\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
|
||||||
|
if ! git diff HEAD~1 --quiet -- "$UBUNTU_DOCKERFILE" ||
|
||||||
|
git describe --candidates=0; then
|
||||||
|
should_build=true
|
||||||
|
else
|
||||||
|
should_build=false
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "msrv=$msrv" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "should_build=$should_build" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "container_path=$REGISTRY/$1" >> "$GITHUB_OUTPUT"
|
||||||
9
.github/workflows/ubuntu.dockerfile
vendored
Normal file
9
.github/workflows/ubuntu.dockerfile
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
FROM ubuntu:latest
|
||||||
|
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
ENV TZ=Etc/UTC
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y xwayland libxcb1 clang libxcb-cursor0 libxcb-cursor-dev curl pkg-config libegl1 \
|
||||||
|
&& rm -r /var/lib/apt/lists/*
|
||||||
|
RUN mkdir /run/xwls-test
|
||||||
|
ENV XDG_RUNTIME_DIR="/run/xwls-test"
|
||||||
|
|
@ -131,7 +131,7 @@ impl Fixture {
|
||||||
// wait for connection
|
// wait for connection
|
||||||
let fd = unsafe { BorrowedFd::borrow_raw(testwl.poll_fd().as_raw_fd()) };
|
let fd = unsafe { BorrowedFd::borrow_raw(testwl.poll_fd().as_raw_fd()) };
|
||||||
let pollfd = PollFd::from_borrowed_fd(fd, PollFlags::IN);
|
let pollfd = PollFd::from_borrowed_fd(fd, PollFlags::IN);
|
||||||
assert!(poll(&mut [pollfd.clone()], -1).unwrap() > 0);
|
assert!(poll(&mut [pollfd.clone()], 1000).unwrap() > 0);
|
||||||
testwl.dispatch();
|
testwl.dispatch();
|
||||||
|
|
||||||
let try_bool_timeout = |b: &AtomicBool| {
|
let try_bool_timeout = |b: &AtomicBool| {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue