Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Version chrome #131

Merged
merged 5 commits into from
May 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 12 additions & 1 deletion console/bumper_ci_service_files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}"`,
},
];
Empty file.
27 changes: 27 additions & 0 deletions tests/console/bumper_test.ts
Original file line number Diff line number Diff line change
@@ -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);
});
51 changes: 29 additions & 22 deletions tests/integration/docker_test/drivers.dockerfile
Original file line number Diff line number Diff line change
@@ -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"
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"