简体   繁体   English

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

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

I'm trying to install mysql client on GitHub actions ubuntu 20.04 using sudo apt-get -f install mysql-client .我正在尝试使用sudo apt-get -f install mysql-client在 GitHub 动作 ubuntu 20.04 上安装 mysql 客户端。 It fails with:它失败了:

mysql-client: Depends: mysql-client-8.0 but it is not going to be installed E: Unable to correct problems, you have held broken packages. mysql-client: 依赖: mysql-client-8.0 但不会安装 E: 无法纠正问题,您持有损坏的软件包。

This is job that contains mysql-client install:这是包含 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

I tried the command with sudo apt-get update & sudo apt-get upgrade .我尝试使用sudo apt-get update & sudo apt-get upgrade But no luck.但没有运气。 How can I install mysql-client?如何安装 mysql 客户端?

GitHub Actions now install mysql-client and some mysql packages by default. GitHub Actions 现在默认安装 mysql-client 和一些 mysql 包。 Therefore no need to install mysql-client, if tried to it will fail.因此无需安装 mysql-client,如果尝试安装会失败。 So I fixed this issue by removing the mysql-client installation step所以我通过删除 mysql-client 安装步骤解决了这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM