简体   繁体   中英

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 . 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.

This is job that contains mysql-client install:

 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 . But no luck. How can I install mysql-client?

GitHub Actions now install mysql-client and some mysql packages by default. Therefore no need to install mysql-client, if tried to it will fail. So I fixed this issue by removing the mysql-client installation step

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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