-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a408ea
commit 286c404
Showing
7 changed files
with
342 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: "headless_display" | ||
description: "Creates a virtual display so e.g Firefox can start" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install mesa3d on Windows | ||
if: runner.os == 'Windows' | ||
uses: ssciwr/setup-mesa-dist-win@9068b6d8a2838cde12e5d36822a1556d782e1aae | ||
with: | ||
version: '22.3.4' | ||
deployment-choice: '5' | ||
- name: Install Cygwin and xvfb on Windows (contained in xorg-server-extra) | ||
if: runner.os == 'Windows' | ||
uses: cygwin/cygwin-install-action@db475590d56881c6cef7b3f96f6f3dd9532ea1f4 | ||
with: | ||
packages: xorg-server xorg-server-extra | ||
- name: Install xvfb on Linux and macOS | ||
if: runner.os != 'Windows' | ||
run: | | ||
if [ "$RUNNER_OS" == "Linux" ]; then | ||
sudo apt-get install xvfb -y | ||
which Xvfb | ||
elif [ "$RUNNER_OS" == "macOS" ]; then | ||
brew install --cask xquartz | ||
echo "XQUARTZ was installed" | ||
sudo /opt/X11/libexec/privileged_startx || true | ||
echo "privileged_startx was executed" | ||
echo "/opt/X11/bin" >> $GITHUB_PATH | ||
else | ||
echo "This Action is only applicaple for Linux and macOS. The current runner is $RUNNER_OS, so this does nothing." | ||
exit 0 | ||
fi | ||
shell: bash | ||
- name: Set DISPLAY env variable | ||
if: runner.os != 'Windows' | ||
run: echo "DISPLAY=:99.0" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Create virtual display with Xvfb | ||
if: runner.os != 'Windows' | ||
run: | | ||
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & | ||
# Wait for xvfb to start | ||
sleep 3 | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: "Install_deps" | ||
description: "Installs the dependencies and updates the system" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install dependencies | ||
run: | | ||
if [ "$RUNNER_OS" == "Linux" ]; then | ||
sudo apt-mark hold grub-efi-amd64-signed # TODO: Remove temporary fix | ||
sudo apt-get update -q -y && sudo apt-get upgrade -y | ||
sudo apt-get install -y libxdo-dev | ||
echo "$RUNNER_OS" | ||
elif [ "$RUNNER_OS" == "Windows" ]; then | ||
echo "$RUNNER_OS" | ||
elif [ "$RUNNER_OS" == "macOS" ]; then | ||
echo "$RUNNER_OS" | ||
else | ||
echo "$RUNNER_OS not supported" | ||
exit 1 | ||
fi | ||
shell: bash |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: "screenshot" | ||
description: "Creates a screenshot" | ||
inputs: | ||
step: | ||
description: 'Step at which the screenshot was taken' | ||
required: true | ||
rust: | ||
description: 'Name of the Rust version' | ||
required: true | ||
platform: | ||
description: 'Name of the OS' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Echo inputs | ||
shell: bash | ||
run: echo "${{ inputs.platform }}_${{ inputs.rust }}_desktop_${{ inputs.step }}" | ||
- uses: OrbitalOwen/desktop-screenshot-action@7f96d072f57e00c3bad73e9f3282f1258262b85d | ||
if: runner.os != 'Linux' | ||
with: | ||
file-name: '${{ inputs.platform }}_${{ inputs.rust }}_desktop_${{ inputs.step }}.jpg' | ||
- name: Take screenshot on Linux | ||
if: runner.os == 'Linux' | ||
shell: bash | ||
run: DISPLAY=$DISPLAY import -window root -quality 90 ./'${{ inputs.platform }}_${{ inputs.rust }}_desktop_${{ inputs.step }}.jpg' | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: desktop_${{ inputs.step }} | ||
path: '${{ inputs.platform }}_${{ inputs.rust }}_desktop_${{ inputs.step }}.jpg' | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: CI | ||
|
||
permissions: | ||
contents: read | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
ci: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
rust: | ||
- stable | ||
- nightly | ||
- "1.64.0" | ||
platform: | ||
- ubuntu-latest | ||
- windows-latest | ||
- macos-latest | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/install_deps | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
components: rustfmt, clippy | ||
|
||
- name: Setup headless display for integration tests on Linux | ||
if: runner.os == 'Linux' # This step is only needed on Linux. The other OSs don't need to be set up | ||
uses: ./.github/actions/headless_display | ||
|
||
- name: Rustfmt | ||
run: | | ||
cargo fmt -- --check | ||
- name: Clippy | ||
run: cargo clippy --all-targets --all-features -- -D warnings | ||
|
||
- name: Build | ||
run: cargo build --all-features --verbose | ||
|
||
- name: Take screenshot | ||
if: always() | ||
uses: ./.github/actions/screenshot | ||
with: | ||
step: during | ||
rust: ${{ matrix.rust }} | ||
platform: ${{ matrix.platform }} | ||
|
||
|
||
|
||
- name: Run tests (minimal) | ||
run: cargo test --no-default-features --lib --bins --tests --verbose | ||
|
||
|
||
- name: Take screenshot | ||
if: always() | ||
uses: ./.github/actions/screenshot | ||
with: | ||
step: during | ||
rust: ${{ matrix.rust }} | ||
platform: ${{ matrix.platform }} | ||
|
||
|
||
|
||
- name: Run tests (normal) | ||
run: cargo test --lib --bins --tests --verbose | ||
|
||
- name: Take screenshot | ||
if: always() | ||
uses: ./.github/actions/screenshot | ||
with: | ||
step: during | ||
rust: ${{ matrix.rust }} | ||
platform: ${{ matrix.platform }} | ||
|
||
- name: Run tests (full) | ||
run: cargo test --all-features --lib --bins --tests --verbose | ||
|
||
- name: Take screenshot | ||
if: always() | ||
uses: ./.github/actions/screenshot | ||
with: | ||
step: during | ||
rust: ${{ matrix.rust }} | ||
platform: ${{ matrix.platform }} | ||
|
||
# Delete duplicate artifacts | ||
- uses: geekyeggo/delete-artifact@v2 | ||
if: always() | ||
with: | ||
name: | | ||
${{ matrix.platform }}_${{ matrix.rust }}_desktop_before.jpg | ||
${{ matrix.platform }}_${{ matrix.rust }}_desktop_during.jpg | ||
${{ matrix.platform }}_${{ matrix.rust }}_desktop_after.jpg |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: failing_tests | ||
|
||
permissions: | ||
contents: read | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
additional_tests: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
rust: | ||
- stable | ||
- nightly | ||
- "1.64.0" | ||
platform: | ||
- ubuntu-latest | ||
- windows-latest | ||
- macos-latest | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/install_deps | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
components: rustfmt, clippy | ||
|
||
- name: Setup headless display for integration tests | ||
if: runner.os == 'Linux' # The integration tests only work on Linux right now | ||
uses: ./.github/actions/headless_display | ||
|
||
- name: Test the code | ||
run: cargo test unit -- --test-threads=1 --include-ignored --nocapture | ||
- name: Test the code with all features enabled | ||
run: cargo test unit --all-features -- --test-threads=1 --include-ignored --nocapture | ||
|
||
- name: Run integration tests | ||
if: runner.os == 'Linux' # The integration tests only work on Linux right now | ||
run: cargo test integration --all-features -- --test-threads=1 --include-ignored --nocapture | ||
|
||
- name: Install Miri | ||
if: ${{ matrix.rust }} == 'nightly' # Miri only works on Nightly | ||
run: | | ||
rustup toolchain install nightly --component miri | ||
rustup override set nightly | ||
cargo clean | ||
cargo miri setup | ||
- name: Run Miri to check unsafe code | ||
if: ${{ matrix.rust }} == 'nightly' # Miri only works on Nightly | ||
run: cargo miri test --verbose --all-features |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: CI | ||
|
||
permissions: | ||
contents: read | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
ci: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
rust: | ||
- stable | ||
- nightly | ||
- "1.64.0" | ||
platform: | ||
- ubuntu-latest | ||
- windows-latest | ||
- macos-latest | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/install_deps | ||
- uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
components: rustfmt, clippy | ||
|
||
- name: Check the code format | ||
run: cargo fmt -- --check | ||
|
||
- name: Check clippy lints | ||
run: cargo clippy --all-targets --all-features -- -D clippy::pedantic | ||
- name: Check clippy lints for the examples | ||
run: cargo clippy --all-targets --all-features --examples -- -D clippy::pedantic | ||
|
||
- name: Build the code | ||
run: cargo build | ||
- name: Build the code with all features enabled | ||
run: cargo build --all-features | ||
|
||
- name: Build the docs | ||
run: cargo doc | ||
- name: Build the docs with all features enabled | ||
run: cargo doc --all-features | ||
|
||
- name: Build the examples | ||
run: cargo build --examples | ||
- name: Build the examples with all features enabled | ||
run: cargo build --examples --all-features | ||
|
||
- name: Setup headless display for integration tests | ||
if: runner.os == 'Linux' # The integration tests only work on Linux right now | ||
uses: ./.github/actions/headless_display | ||
|
||
- name: Test the code | ||
run: cargo test unit -- --test-threads=1 --nocapture | ||
- name: Test the code with all features enabled | ||
run: cargo test unit --all-features -- --test-threads=1 --nocapture | ||
|
||
- uses: OrbitalOwen/[email protected] | ||
with: | ||
file-name: 'desktop_before.jpg' | ||
if: runner.os == 'macOS' | ||
|
||
- name: Run integration tests | ||
if: runner.os != 'Windows' # The integration tests only work on Linux right now | ||
run: cargo test integration --all-features -- --test-threads=1 --include-ignored --nocapture | ||
|
||
- uses: OrbitalOwen/[email protected] | ||
with: | ||
file-name: 'desktop_after.jpg' | ||
if: always() && runner.os == 'macOS' | ||
|
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