ci: show webdriver output for flaky os/browsers (#593) #276
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: Test | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
tests: ${{ steps.set-tests.outputs.tests }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Clojure deps cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.m2/repository | |
~/.deps.clj | |
~/.gitlibs | |
enableCrossOsArchive: true | |
key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }} | |
restore-keys: cljdeps- | |
- name: "Setup Java" | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- name: Install Clojure Tools | |
uses: DeLaGuardo/setup-clojure@12.5 | |
with: | |
bb: 'latest' | |
# This assumes downloaded deps are same for all OSes | |
- name: Bring down deps | |
run: bb download-deps | |
- id: set-tests | |
name: Set test var for matrix | |
# run test.clj directly instead of via bb task to avoid generic task output | |
run: echo "tests=$(bb script/test_matrix.clj --format json)" >> $GITHUB_OUTPUT | |
build: | |
needs: setup | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: ${{fromJSON(needs.setup.outputs.tests)}} | |
name: ${{ matrix.desc }} | |
steps: | |
- name: Don't convert line endings on checkout (Windows) | |
if: matrix.os == 'windows' | |
run: git config --global core.autocrlf false | |
- name: Tune Windows network | |
if: ${{ matrix.os == 'windows' }} | |
run: Disable-NetAdapterChecksumOffload -Name * -TcpIPv4 -UdpIPv4 -TcpIPv6 -UdpIPv6 | |
- name: Tune macOS network | |
if: ${{ matrix.os == 'macos' }} | |
run: | | |
sudo sysctl -w net.link.generic.system.hwcksum_tx=0 | |
sudo sysctl -w net.link.generic.system.hwcksum_rx=0 | |
- name: Install Ubuntu X11 Utils | |
if: ${{ matrix.os == 'ubuntu' }} | |
run: sudo apt-get -y install x11-utils | |
- name: Install Linux Windows Manager | |
if: ${{ matrix.os == 'ubuntu' }} | |
run: sudo apt-get -y install fluxbox | |
# No longer pre-installed on macOS github action runners | |
- name: Install Image Magick on macOS | |
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'imagemagick') }} | |
run: brew install imagemagick | |
# No longer pre-installed on macOS github action runners | |
- name: Install Microsoft Edge on macOS | |
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'edge') }} | |
run: | | |
brew install --cask microsoft-edge | |
EDGE_VERSION=$(defaults read /Applications/Microsoft\ Edge.app/Contents/Info CFBundleShortVersionString) | |
DRIVER_URL="https://msedgedriver.azureedge.net/${EDGE_VERSION}/edgedriver_mac64_m1.zip" | |
curl -o msedgedriver.zip $DRIVER_URL | |
mkdir $RUNNER_TEMP/edgedriver | |
unzip msedgedriver.zip -d $RUNNER_TEMP/edgedriver | |
echo "$RUNNER_TEMP/edgedriver" >> $GITHUB_PATH | |
# No longer pre-installed on macOS github action runners | |
- name: Install Firefox on macOS | |
if: ${{ matrix.os == 'macos' && contains(matrix.needs, 'firefox') }} | |
run: | | |
brew install --cask firefox | |
brew install geckodriver | |
- uses: actions/checkout@v4 | |
- name: Restore Clojure deps from cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
~/.m2/repository | |
~/.deps.clj | |
~/.gitlibs | |
enableCrossOsArchive: true | |
key: cljdeps-${{ hashFiles('deps.edn', 'bb.edn') }} | |
restore-keys: cljdeps- | |
- name: Cache fixup for Windows | |
# cache is restored using relative paths from Linux, this is not appropriate for Windows | |
# this is admitedly fragile/hackey, will revisit if it cracks | |
if: ${{ matrix.os == 'windows' }} | |
run: | | |
mv ../../../.m2 ${USERPROFILE} | |
mv ../../../.deps.clj ${USERPROFILE} | |
mv ../../../.gitlibs ${USERPROFILE} | |
shell: bash | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: ${{ matrix.jdk-version }} | |
- name: Install Clojure Tools | |
uses: DeLaGuardo/setup-clojure@12.5 | |
with: | |
bb: 'latest' | |
- name: Tools versions | |
run: bb tools-versions | |
- name: Run Tests | |
run: ${{ matrix.cmd }} |