如何将travis ci配置转换为github操作并使用多个版本的python进行测试?

hs1rzwqc  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(179)

我们已经使用travis ci大约5年了,但是我们最近遇到了问题,他们的支持也帮不上忙。我正在考虑改用github操作。我们使用travis ci用4个版本的python(3.6到3.9)测试代码,我想用github操作做同样的测试。这是我们的 .travis.yml 文件:

language: python
python:
  - "3.6"
  - "3.7"
  - "3.8"
  - "3.9"
sudo: required
dist: bionic
addons:
  postgresql: "9.6"
services:
  - postgresql
before_script:
  - psql --version
  - psql -c 'create user pguser;' -U postgres
  - psql -c 'alter user pguser createdb; ' -U postgres
install:
  - cp env.ini.tests env.ini
  - pip install --upgrade -r requirements.txt
  - pip freeze
  - pwd
  - lsb_release -a
script:
  - cd speedy/net
  - python tests_manage.py test # python -W error::DeprecationWarning tests_manage.py test
  - cd ../match
  - python tests_manage.py test # python -W error::DeprecationWarning tests_manage.py test
  - cd ../composer
  - python tests_manage.py test # python -W error::DeprecationWarning tests_manage.py test
  - cd ../mail
  - python tests_manage.py test # python -W error::DeprecationWarning tests_manage.py test

我读到了github的操作,我正在尝试创建一个文件 .github/workflows/main.yml ,但我不知道如何定义它。如何定义此文件以使用github操作运行测试?总的来说,我想把我们的 .travis.yml 配置到github操作。
这是 .github/workflows/main.yml 我从以下文件开始:

name: GitHub Actions Speedy Net
on: [push]
jobs:
  tests:
    runs-on: ubuntu-latest
    steps:
      - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
      - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
      - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
      - name: Check out repository code
        uses: actions/checkout@v2
      - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
      - run: echo "🖥️ The workflow is now ready to test your code on the runner."
      - name: List files in the repository
        run: |
          ls ${{ github.workspace }}
      - run: echo "🍏 This job's status is ${{ job.status }}."

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题