diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 62c9d0ab..bb66a908 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -21,6 +21,20 @@ jobs: docker exec drivers deno test -A --config tsconfig.json --no-check=remote tests/integration docker exec drivers deno test -A --config tsconfig.json --no-check=remote tests/unit + console-tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install Deno + uses: denoland/setup-deno@v1 + with: + deno-version: vx.x.x + + - name: Run Console Tests + run: | + deno test -A tests/console tests: strategy: diff --git a/console/bumper_ci_service_files.ts b/console/bumper_ci_service_files.ts index c30e9eb6..55746ebe 100644 --- a/console/bumper_ci_service_files.ts +++ b/console/bumper_ci_service_files.ts @@ -17,4 +17,15 @@ export const preReleaseFiles = [ }, ]; -export const bumperFiles = []; +const chromeVersionsRes = await fetch( + "https://versionhistory.googleapis.com/v1/chrome/platforms/win/channels/stable/versions", +); +const { versions } = await chromeVersionsRes.json(); + +export const bumperFiles = [ + { + filename: "./tests/integration/docker_test/drivers.dockerfile", + replaceTheRegex: /ENV CHROME_VERSION \".*\"/, + replaceWith: `ENV CHROME_VERSION "${versions[0].version}"`, + }, +]; diff --git a/console/update_deno_version_strings.ts b/console/update_deno_version_strings.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/console/bumper_test.ts b/tests/console/bumper_test.ts new file mode 100644 index 00000000..0efa02bd --- /dev/null +++ b/tests/console/bumper_test.ts @@ -0,0 +1,27 @@ +import { assertEquals } from "../../deps.ts"; + +Deno.test("Updates chrome version in dockerfile", async () => { + const chromeVersionsRes = await fetch( + "https://versionhistory.googleapis.com/v1/chrome/platforms/win/channels/stable/versions", + ); + const { versions } = await chromeVersionsRes.json(); + const version = versions[0].version; + const originalContents = Deno.readTextFileSync( + "./tests/integration/docker_test/drivers.dockerfile", + ); + let newContent = originalContents; + newContent.replace(/CHROME_VERSION \".*\"/, 'CHROME VERSION "123"'); + Deno.writeTextFileSync( + "./tests/integration/docker_test/drivers.dockerfile", + newContent, + ); + const p = Deno.run({ + cmd: ["deno", "run", "-A", "console/bumper_ci_service.ts"], + }); + await p.status(); + p.close(); + newContent = Deno.readTextFileSync( + "./tests/integration/docker_test/drivers.dockerfile", + ); + assertEquals(newContent.includes(`CHROME_VERSION "${version}"`), true); +}); diff --git a/tests/integration/docker_test/drivers.dockerfile b/tests/integration/docker_test/drivers.dockerfile index 02f29a9f..38229ed8 100644 --- a/tests/integration/docker_test/drivers.dockerfile +++ b/tests/integration/docker_test/drivers.dockerfile @@ -1,30 +1,37 @@ FROM debian:stable-slim +ENV CHROME_VERSION "101.0.4951.54" + # Install chrome driver -RUN apt update -y && apt clean -y -RUN apt install gnupg -y -ENV CHROME_VERSION "google-chrome-stable" -RUN sed -i -- 's&deb http://deb.debian.org/debian jessie-updates main&#deb http://deb.debian.org/debian jessie-updates main&g' /etc/apt/sources.list \ - && apt-get update && apt-get install wget -y -RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ - && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list \ - && apt-get update && apt-get -qqy install ${CHROME_VERSION:-google-chrome-stable} +RUN apt update -y \ + && apt-get upgrade -y \ + && apt clean -y \ + && apt-get install wget -y \ + && wget http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}-1_amd64.deb \ + && apt-get install -y ./google-chrome-stable_${CHROME_VERSION}-1_amd64.deb + +# 2nd method of doing it: +# RUN sed -i -- 's&deb http://deb.debian.org/debian jessie-updates main&#deb http://deb.debian.org/debian jessie-updates main&g' /etc/apt/sources.list \ +# && apt-get update && apt-get install wget -y +# RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ +# && echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list \ +# && apt-get update && apt-get -qqy install google-chrome-stable # Install firefox driver -RUN apt update && apt install wget curl bzip2 -y -RUN apt-get remove iceweasel -ENV FILENAME "firefox-latest.tar.bz2" -RUN wget -O $FILENAME --content-disposition "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US" \ - && apt install bzip2 -RUN tar -jxf $FILENAME -C /opt/ -RUN ln -sf /opt/firefox/firefox /usr/bin/firefox -RUN rm $FILENAME +# RUN apt update && apt install wget curl bzip2 -y +# RUN apt-get remove iceweasel +# ENV FILENAME "firefox-latest.tar.bz2" +# RUN wget -O $FILENAME --content-disposition "https://download.mozilla.org/?product=firefox-latest-ssl&os=linux64&lang=en-US" \ +# && apt install bzip2 +# RUN tar -jxf $FILENAME -C /opt/ +# RUN ln -sf /opt/firefox/firefox /usr/bin/firefox +# RUN rm $FILENAME # Taken from: https://medium.com/@cloverinks/how-to-fix-puppetteer-error-ibx11-xcb-so-1-on-ubuntu-152c336368 -RUN apt install libgtk-3-0 libx11-6 libx11-xcb1 libdbus-glib-1-2 xdg-utils -y -RUN apt clean +# RUN apt install libgtk-3-0 libx11-6 libx11-xcb1 libdbus-glib-1-2 xdg-utils -y +# RUN apt clean # Install deno -RUN apt install curl unzip -y -RUN curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL=/usr/local sh -RUN export DENO_INSTALL="/root/.local" -RUN export PATH="$DENO_INSTALL/bin:$PATH" \ No newline at end of file +RUN apt install curl unzip -y \ + && curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL=/usr/local sh \ + && export DENO_INSTALL="/root/.local" \ + && export PATH="$DENO_INSTALL/bin:$PATH" \ No newline at end of file