From a8052f594af393768ee4c2fa531ae9241360788a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Tyczy=C5=84ski?= Date: Wed, 26 Jul 2023 09:49:34 +0200 Subject: [PATCH 1/3] run tests in docker --- .github/workflows/build-and-test.yaml | 19 ++++++++++++++++++- build/docker/Dockerfile | 7 +++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index e4422f7a57..6e21e319a3 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -215,7 +215,24 @@ jobs: with: ref: ${{ inputs.ref || github.ref }} - - name: Docker + - name: Build in Docker run: | docker build -t shaka-player-build build/docker docker run -v $(pwd):/usr/src --user $(id -u):$(id -g) shaka-player-build + + test_in_docker: + # Don't waste time doing a full matrix of test runs when there was an + # obvious linter error. + needs: lint + name: Docker + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: ${{ inputs.ref || github.ref }} + + - name: Test in Docker + run: | + docker build -t shaka-player-build build/docker + docker run -v $(pwd):/usr/src --user $(id -u):$(id -g) shaka-player-build python3 build/test.py --quick --browsers ChromeHeadless diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index cb9c5d42a5..05fdcd7f04 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -2,14 +2,17 @@ # docker build -t shaka-player-build /path/to/shaka-player/build/docker # Run with: # docker run -v /path/to/shaka-player:/usr/src --user $(id -u):$(id -g) shaka-player-build +# Run tests with: +# docker run -v /path/to/shaka-player:/usr/src --user $(id -u):$(id -g) shaka-player-build python3 build/test.py --quick --browsers ChromeHeadless -FROM alpine:3.14 +FROM alpine:3.18 # Install dependencies RUN apk add --update --no-cache \ - bash git nodejs npm openjdk11-jre-headless python3 + bash chromium chromium-chromedriver git nodejs npm openjdk11-jre-headless python3 WORKDIR /usr/src ENV HOME /tmp +ENV CHROMEDRIVER_PATH /usr/bin/chromedriver CMD ["python3", "build/all.py"] From 9e8f8adbb429c38a061edae163e561b1427b0eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Tyczy=C5=84ski?= Date: Wed, 26 Jul 2023 10:41:26 +0200 Subject: [PATCH 2/3] make test as a last step build_in_docker job --- .github/workflows/build-and-test.yaml | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 6e21e319a3..10f8784bae 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -214,25 +214,9 @@ jobs: uses: actions/checkout@v3 with: ref: ${{ inputs.ref || github.ref }} - + - name: Build Docker image + run: docker build -t shaka-player-build build/docker - name: Build in Docker - run: | - docker build -t shaka-player-build build/docker - docker run -v $(pwd):/usr/src --user $(id -u):$(id -g) shaka-player-build - - test_in_docker: - # Don't waste time doing a full matrix of test runs when there was an - # obvious linter error. - needs: lint - name: Docker - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - ref: ${{ inputs.ref || github.ref }} - + run: docker run -v $(pwd):/usr/src --user $(id -u):$(id -g) shaka-player-build - name: Test in Docker - run: | - docker build -t shaka-player-build build/docker - docker run -v $(pwd):/usr/src --user $(id -u):$(id -g) shaka-player-build python3 build/test.py --quick --browsers ChromeHeadless + run: docker run -v $(pwd):/usr/src --user $(id -u):$(id -g) shaka-player-build python3 build/test.py --quick --browsers ChromeHeadless From 4d00385722ad5335265ca6c7f7dfe9c848aba172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Tyczy=C5=84ski?= Date: Tue, 8 Aug 2023 12:14:46 +0200 Subject: [PATCH 3/3] revert build-and-test.yaml --- .github/workflows/build-and-test.yaml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 10f8784bae..e4422f7a57 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -214,9 +214,8 @@ jobs: uses: actions/checkout@v3 with: ref: ${{ inputs.ref || github.ref }} - - name: Build Docker image - run: docker build -t shaka-player-build build/docker - - name: Build in Docker - run: docker run -v $(pwd):/usr/src --user $(id -u):$(id -g) shaka-player-build - - name: Test in Docker - run: docker run -v $(pwd):/usr/src --user $(id -u):$(id -g) shaka-player-build python3 build/test.py --quick --browsers ChromeHeadless + + - name: Docker + run: | + docker build -t shaka-player-build build/docker + docker run -v $(pwd):/usr/src --user $(id -u):$(id -g) shaka-player-build