GitHub Actions上でsymfony/panther
を動かそうかなと思っていたときに、ubuntu-latest
を使用していたので、ubuntu用のインストール手順が必要でした。
そのため、以下のコマンドを実行する必要があります。
$ apt-get install chromium-chromedriver firefox-geckodriver
そのため、このようなワークフローになるかと思います。(以前から使ってたワークフローだったのでactions/checkout
のバージョンが古いままですね)
name: クローリングするぞ on: workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: initialize run: | apt-get install chromium-chromedriver firefox-geckodriver
これをGithub Actionsで実行してみたのですが、以下のようなログを出力してエラーになってしまいました。
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root? Error: Process completed with exit code 100.
どうやら権限が足りないようです。
そこで、apt-get
しているところにsudoを追加してみます。
name: クローリングするぞ on: workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: initialize run: | sudo apt-get install chromium-chromedriver firefox-geckodriver
これを実行してみると
Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed: chromium-browser The following NEW packages will be installed: chromium-browser chromium-chromedriver firefox-geckodriver 0 upgraded, 3 newly installed, 0 to remove and 13 not upgraded. Need to get 1194 kB of archives. After this operation, 4231 kB of additional disk space will be used. Get:1 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe amd64 chromium-browser amd64 1:85.0.4183.83-0ubuntu0.20.04.2 [48.3 kB] Get:2 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe amd64 chromium-chromedriver amd64 1:85.0.4183.83-0ubuntu0.20.04.2 [2496 B] Get:3 http://azure.archive.ubuntu.com/ubuntu focal-updates/universe amd64 firefox-geckodriver amd64 93.0+build1-0ubuntu0.20.04.1 [1143 kB] Preconfiguring packages ... Fetched 1194 kB in 0s (25.7 MB/s) Selecting previously unselected package chromium-browser. (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 231626 files and directories currently installed.) Preparing to unpack .../chromium-browser_1%3a85.0.4183.83-0ubuntu0.20.04.2_amd64.deb ... => Installing the chromium snap ==> Checking connectivity with the snap store ==> Installing the chromium snap chromium 94.0.4606.81 from Canonical✓ installed => Snap installation complete Unpacking chromium-browser (1:85.0.4183.83-0ubuntu0.20.04.2) ... Selecting previously unselected package chromium-chromedriver. Preparing to unpack .../chromium-chromedriver_1%3a85.0.4183.83-0ubuntu0.20.04.2_amd64.deb ... Unpacking chromium-chromedriver (1:85.0.4183.83-0ubuntu0.20.04.2) ... Selecting previously unselected package firefox-geckodriver. Preparing to unpack .../firefox-geckodriver_93.0+build1-0ubuntu0.20.04.1_amd64.deb ... Unpacking firefox-geckodriver (93.0+build1-0ubuntu0.20.04.1) ... Setting up firefox-geckodriver (93.0+build1-0ubuntu0.20.04.1) ... Setting up chromium-browser (1:85.0.4183.83-0ubuntu0.20.04.2) ... Setting up chromium-chromedriver (1:85.0.4183.83-0ubuntu0.20.04.2) ... Processing triggers for hicolor-icon-theme (0.17-2) ... Processing triggers for mime-support (3.64ubuntu1) ...
無事、apt-get
が成功しました!