簡體   English   中英

在 GitHub 操作 Ubuntu 20.04 上安裝 mysql-client

[英]Install mysql-client on GitHub actions Ubuntu 20.04

我正在嘗試使用sudo apt-get -f install mysql-client在 GitHub 動作 ubuntu 20.04 上安裝 mysql 客戶端。 它失敗了:

mysql-client: 依賴: mysql-client-8.0 但不會安裝 E: 無法糾正問題,您持有損壞的軟件包。

這是包含 mysql-client 安裝的作業:

 test:
name: Unit and Integration Tests
runs-on: ubuntu-20.04
needs:
  - pre-ci
steps:
  - name: Checkout the code
    uses: actions/checkout@v2
  - name: Setup python
    uses: actions/setup-python@v2
    with:
      python-version: "3.10"
  - name: Set up QEMU
    uses: docker/setup-qemu-action@v1
  - name: Set up Docker Buildx
    uses: docker/setup-buildx-action@v1
  - name: Install python dev dependencies
    run: |
      python3 -m pip install --upgrade pip
      pip3 install -r requirements-dev.txt
  - name: Setup Chrome webdriver
    uses: nanasess/setup-chromedriver@master
  - name: Setup Chrome Display
    run: |
      sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional, disables headless mode
  - name: Install the MySQL client
    run: sudo apt-get update & sudo apt-get upgrade & sudo apt-get -f install mysql-client
  - name: Create a .env file
    run: |
      cat << EOF > .env
      MYSQL_HOST=localhost
      MYSQL_USER=asset-app
      MYSQL_PASSWORD=password
      MYSQL_DATABASE=asset_db
      MYSQL_PORT=3306
      REDIS_HOST=localhost
      REDIS_PORT=6379
      REDIS_DB=0
      SECRET_KEY=bff4eb94deb028b293786461
      EOF
  - name: Docker compose up
    run: docker-compose up -d
  - name: Wait for 15 seconds for the setup to start
    run: sleep 15
  - name: Add mysql tables and data
    run: |
      mysql -h localhost -P 3306 --protocol=tcp -u root --password=password < scripts/table.sql
  - name: Test with pytest
    run: |
      pytest tests --verbose --failed-first
      ls -la
    env:
      DISPLAY: :99
  - name: Kill the docker compose
    run: docker-compose kill
  - name: cancel workflow
    if: failure()
    uses: andymckay/cancel-action@0.2

我嘗試使用sudo apt-get update & sudo apt-get upgrade 但沒有運氣。 如何安裝 mysql 客戶端?

GitHub Actions 現在默認安裝 mysql-client 和一些 mysql 包。 因此無需安裝 mysql-client,如果嘗試安裝會失敗。 所以我通過刪除 mysql-client 安裝步驟解決了這個問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM