Skip to content
This repository was archived by the owner on Mar 4, 2024. It is now read-only.

Commit b4134a8

Browse files
CI: add a simple github action
1 parent 2de5380 commit b4134a8

File tree

3 files changed

+147
-5
lines changed

3 files changed

+147
-5
lines changed

.github/workflows/CI.yml

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
on:
2+
push:
3+
branches: [master]
4+
pull_request:
5+
6+
name: CI
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
container:
12+
image: ubuntu:20.10
13+
strategy:
14+
matrix:
15+
rust:
16+
- stable
17+
- beta
18+
- nightly
19+
- "1.40.0"
20+
steps:
21+
- run: apt-get update -y
22+
- run: apt-get install -y libgtk-3-dev libglib2.0-dev libgraphene-1.0-dev git xvfb curl libcairo-gobject2 libcairo2-dev
23+
- uses: actions/checkout@v2
24+
- uses: actions-rs/toolchain@v1
25+
with:
26+
toolchain: ${{ matrix.rust }}
27+
override: true
28+
# atk
29+
- name: "atk: tests"
30+
run: xvfb-run --auto-servernum cargo test --manifest-path atk/Cargo.toml --all-features
31+
- name: "atk-sys: tests"
32+
run: xvfb-run --auto-servernum cargo test --manifest-path atk/sys/Cargo.toml --all-features
33+
- name: "atk: build"
34+
run: cargo build --manifest-path atk/Cargo.toml --all-features
35+
# cairo
36+
- name: "cairo: tests"
37+
run: xvfb-run --auto-servernum cargo test --manifest-path cairo/Cargo.toml --features "png,pdf,svg,ps,use_glib,v1_16,freetype,script,xcb,xlib,win32-surface"
38+
- name: "cairo-sys: tests"
39+
run: xvfb-run --auto-servernum cargo test --manifest-path cairo/sys/Cargo.toml --features "png,pdf,svg,ps,use_glib,v1_16,freetype,script,xcb,xlib,win32-surface"
40+
- name: "cairo: build"
41+
run: cargo build --manifest-path cairo/Cargo.toml --features "png,pdf,svg,ps,use_glib,v1_16,freetype,script,xcb,xlib,win32-surface"
42+
# gdk
43+
- name: "gdk: tests"
44+
run: xvfb-run --auto-servernum cargo test --manifest-path gdk/Cargo.toml --features v3_24
45+
- name: "gdk: build"
46+
run: cargo build --manifest-path gdk/Cargo.toml --features v3_24
47+
# gdk-pixbuf
48+
- name: "gdk-pixbuf: tests"
49+
run: xvfb-run --auto-servernum cargo test --manifest-path gdk-pixbuf/Cargo.toml --all-features
50+
- name: "gdk-pixbuf-sys: tests"
51+
run: xvfb-run --auto-servernum cargo test --manifest-path gdk-pixbuf/sys/Cargo.toml --all-features
52+
- name: "gdk-pixbuf: build"
53+
run: cargo build --manifest-path gdk-pixbuf/Cargo.toml --all-features
54+
# gdkx11
55+
- name: "gdkx11: tests"
56+
run: xvfb-run --auto-servernum cargo test --manifest-path gdkx11/Cargo.toml --all-features
57+
- name: "gdkx11-sys: tests"
58+
run: xvfb-run --auto-servernum cargo test --manifest-path gdkx11/sys/Cargo.toml --all-features
59+
- name: "gdkx11: build"
60+
run: cargo build --manifest-path gdkx11/Cargo.toml --all-features
61+
# gio
62+
- name: "gio: tests"
63+
run: xvfb-run --auto-servernum cargo test --manifest-path gio/Cargo.toml --all-features
64+
- name: "gio: build"
65+
run: cargo build --manifest-path gio/Cargo.toml --all-features
66+
# glib
67+
- name: "glib: tests"
68+
run: xvfb-run --auto-servernum cargo test --manifest-path glib/Cargo.toml --all-features
69+
- name: "glib: build"
70+
run: cargo build --manifest-path glib/Cargo.toml --all-features
71+
# glib-macros
72+
- name: "glib-macros: tests"
73+
run: xvfb-run --auto-servernum cargo test --manifest-path glib-macros/Cargo.toml
74+
- name: "glib-macros: build"
75+
run: cargo build --manifest-path glib-macros/Cargo.toml
76+
# graphene
77+
- name: "graphene: tests"
78+
run: xvfb-run --auto-servernum cargo test --manifest-path graphene/Cargo.toml --all-features
79+
- name: "graphene: build"
80+
run: cargo build --manifest-path graphene/Cargo.toml --all-features
81+
# gtk
82+
- name: "gtk: tests"
83+
run: xvfb-run --auto-servernum cargo test --manifest-path gtk/Cargo.toml --all-features
84+
- name: "gtk: build"
85+
run: cargo build --manifest-path gtk/Cargo.toml --all-features
86+
# pango
87+
- name: "pango: tests"
88+
run: xvfb-run --auto-servernum cargo test --manifest-path pango/Cargo.toml --all-features
89+
- name: "pango-sys: tests"
90+
run: xvfb-run --auto-servernum cargo test --manifest-path pango/sys/Cargo.toml --all-features
91+
- name: "pango: build"
92+
run: cargo build --manifest-path pango/Cargo.toml --all-features
93+
# pangocairo
94+
- name: "pangocairo: tests"
95+
run: xvfb-run --auto-servernum cargo test --manifest-path pangocairo/Cargo.toml --all-features
96+
- name: "pangocairo-sys: tests"
97+
run: xvfb-run --auto-servernum cargo test --manifest-path pangocairo/sys/Cargo.toml --all-features
98+
- name: "pangocairo: build"
99+
run: cargo build --manifest-path pangocairo/Cargo.toml --all-features
100+
# examples
101+
- name: "examples"
102+
run: cargo build --manifest-path examples/Cargo.toml --bins --examples --all-features
103+
104+
- run: git diff -R --exit-code
105+
- uses: bcomnes/cleanup-xvfb@v1
106+
107+
fmt:
108+
name: rust fmt
109+
runs-on: ubuntu-latest
110+
steps:
111+
- uses: actions/checkout@v2
112+
- uses: actions-rs/toolchain@v1
113+
with:
114+
profile: minimal
115+
toolchain: stable
116+
override: true
117+
- run: rustup component add rustfmt
118+
- uses: actions-rs/cargo@v1
119+
with:
120+
command: fmt
121+
args: --all -- --check
122+
123+
checker:
124+
name: gtk-rs checker
125+
runs-on: ubuntu-latest
126+
steps:
127+
- uses: actions/checkout@v2
128+
with:
129+
repository: gtk-rs/checker
130+
ref: master
131+
path: checker
132+
- working-directory: checker
133+
run: cargo build --release
134+
- run: "./checker/target/release/checker ."
135+
- run: "./checker/check_init_asserts"

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ members = [
2727
"pangocairo/sys",
2828
]
2929

30-
exclude = ["gir"]
30+
exclude = ["gir", "checker"]

gio/sys/tests/abi.rs

+11-4
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,22 @@ use std::str;
1515
use tempfile::Builder;
1616

1717
static PACKAGES: &[&str] = &["gio-2.0"];
18+
static PACKAGES_FALLBACK: &[&str] = &["gio-2.0-unix", "glib-2.0"];
1819

1920
#[derive(Clone, Debug)]
2021
struct Compiler {
2122
pub args: Vec<String>,
2223
}
2324

2425
impl Compiler {
25-
pub fn new() -> Result<Compiler, Box<dyn Error>> {
26+
pub fn new(packages: &[&str]) -> Result<Compiler, Box<dyn Error>> {
2627
let mut args = get_var("CC", "cc")?;
2728
args.push("-Wno-deprecated-declarations".to_owned());
2829
// For %z support in printf when using MinGW.
2930
args.push("-D__USE_MINGW_ANSI_STDIO".to_owned());
3031
args.extend(get_var("CFLAGS", "")?);
3132
args.extend(get_var("CPPFLAGS", "")?);
32-
args.extend(pkg_config_cflags(PACKAGES)?);
33+
args.extend(pkg_config_cflags(packages)?);
3334
Ok(Compiler { args })
3435
}
3536

@@ -131,7 +132,10 @@ fn cross_validate_constants_with_c() {
131132
.prefix("abi")
132133
.tempdir()
133134
.expect("temporary directory");
134-
let cc = Compiler::new().expect("configured compiler");
135+
let cc = match Compiler::new(PACKAGES) {
136+
Ok(cc) => Ok(cc),
137+
Err(_) => Compiler::new(PACKAGES_FALLBACK),
138+
}.expect("configured compiler");
135139

136140
assert_eq!(
137141
"1",
@@ -171,7 +175,10 @@ fn cross_validate_layout_with_c() {
171175
.prefix("abi")
172176
.tempdir()
173177
.expect("temporary directory");
174-
let cc = Compiler::new().expect("configured compiler");
178+
let cc = match Compiler::new(PACKAGES) {
179+
Ok(cc) => Ok(cc),
180+
Err(_) => Compiler::new(PACKAGES_FALLBACK),
181+
}.expect("configured compiler");
175182

176183
assert_eq!(
177184
Layout {

0 commit comments

Comments
 (0)