From 52caa8c8ce9a7a19499d052fbed8d94a00e0dd85 Mon Sep 17 00:00:00 2001 From: 1138-4EB <1138-4EB@users.noreply.github.com> Date: Mon, 9 Sep 2019 02:45:15 +0200 Subject: [PATCH] ci: migrate from Travis and AppVeyor to GitHub Actions --- .appveyor.yml | 51 ----------- .github/workflows/push.yml | 175 +++++++++++++++++++++++++++++++++++++ .travis.yml | 86 ------------------ 3 files changed, 175 insertions(+), 137 deletions(-) delete mode 100644 .appveyor.yml create mode 100644 .github/workflows/push.yml delete mode 100644 .travis.yml diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index d7ec812f9e..0000000000 --- a/.appveyor.yml +++ /dev/null @@ -1,51 +0,0 @@ -# For Windows based CI - -environment: - - matrix: - - # For Python versions available on Appveyor, see - # http://www.appveyor.com/docs/installed-software#python - - - BUILD_NAME: py27-unit - PYTHON: "C:\\Python27" - - BUILD_NAME: py34-unit - PYTHON: "C:\\Python34" - - BUILD_NAME: py35-unit - PYTHON: "C:\\Python35" - - BUILD_NAME: py36-unit - PYTHON: "C:\\Python36" - - BUILD_NAME: py37-unit - PYTHON: "C:\\Python37" - - - BUILD_NAME: py37-lint - PYTHON: "C:\\Python37" - - - BUILD_NAME: py27-docs - PYTHON: "C:\\Python27" - - BUILD_NAME: py37-docs - PYTHON: "C:\\Python37" - - - BUILD_NAME: py27-acceptance-ghdl - PYTHON: "C:\\Python27" - - BUILD_NAME: py37-acceptance-ghdl - PYTHON: "C:\\Python37" - - - BUILD_NAME: py37-vcomponents-ghdl - PYTHON: "C:\\Python37" - -install: - - "git submodule update --init --recursive" - - "%PYTHON%\\python.exe -m pip install -U pip" - - "%PYTHON%\\python.exe -m pip install -U virtualenv" - - "%PYTHON%\\python.exe -m pip install tox" - - "curl -fsSL -o ghdl.zip https://github.com/ghdl/ghdl/releases/download/v0.36/ghdl-0.36-mingw32-mcode.zip" - - "7z x ghdl.zip -o../ghdl -y" - - "mv ../ghdl/GHDL/0.36-mingw32-mcode/ ../ghdl-v0.36" - - "rm -rf ../ghdl ghdl.zip" - - "set PATH=%PATH%;../ghdl-v0.36/bin" - -build: off - -test_script: - - "%PYTHON%\\python.exe -m tox -e %BUILD_NAME%" diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000000..fb415e7066 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,175 @@ +name: 'push' + +on: [ push, pull_request ] + +jobs: + + + lin: + strategy: + fail-fast: false + max-parallel: 4 + matrix: + task: [ + 37-fmt, + 37-lint, + 27-unit, + 35-unit, + 37-unit, + 27-docs, + 37-docs, + ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: git submodule update + run: git submodule update --init --recursive + if: matrix.task.do == 'docs' + - uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: install dependencies + run: | + pip install -U pip + pip install -U virtualenv tox + + - if: matrix.task != '37-fmt' + name: run job + env: + TASK: ${{ matrix.task }} + run: | + tox -e py${TASK} + + - if: matrix.task == '37-fmt' + name: "[py37-fmt only] run 'black'" + run: tox -e py37-fmt -- --check + + - name: '[py37-docs && push only] publish site to gh-pages' + if: matrix.task == '37-docs' && github.event_name != 'pull_request' + env: + GH_SHA: ${{ github.sha }} + GH_DEPKEY: ${{ secrets.VUNIT_GITHUB_IO_DEPLOY_KEY }} + run: | + cd .tox/py37-docs/tmp/docsbuild/ + touch .nojekyll + + git init + git add . + git config --local user.email "push@gha" + git config --local user.name "GHA" + git commit -a -m "update $GH_SHA" + + git remote add origin git@github.com:VUnit/VUnit.github.io + + eval `ssh-agent -t 60 -s` + echo "$GH_DEPKEY" | ssh-add - + mkdir -p ~/.ssh/ + ssh-keyscan github.com >> ~/.ssh/known_hosts + git push -u origin +master + ssh-agent -k + + + docker: + strategy: + fail-fast: false + max-parallel: 3 + matrix: + task: [ + {do: 27-acceptance, tag: mcode-2}, + {do: 38-acceptance, tag: llvm}, + {do: 38-vcomponents, tag: mcode}, + ] + runs-on: ubuntu-latest + env: + DOCKER_REGISTRY: docker.pkg.github.com + steps: + - uses: actions/checkout@v1 + - name: git submodule update + run: git submodule update --init --recursive + - name: docker login + run: echo "$GH_TOKEN" | docker login -u vunit-gha --password-stdin "$DOCKER_REGISTRY" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: run job + env: + IMAGE: docker.pkg.github.com/vunit/vunit/dev:${{ matrix.task.tag }} + BUILD_NAME: py${{ matrix.task.do }}-ghdl + run: | + docker run --rm -tv $(pwd):/src -w /src "$IMAGE" tox -e $BUILD_NAME + - name: docker logout + run: docker logout "$DOCKER_REGISTRY" + if: always() + + + win: + strategy: + fail-fast: false + max-parallel: 4 + matrix: + task: [ + 27-acceptance-ghdl, + 37-acceptance-ghdl, + 37-vcomponents-ghdl, + 37-lint, + 27-unit, + 35-unit, + 37-unit, + 27-docs, + 37-docs, + ] + runs-on: windows-latest + steps: + - uses: actions/checkout@v1 + - name: git submodule update + run: git submodule update --init --recursive + if: (endsWith( matrix.task, '-lint' ) || endsWith( matrix.task, '-unit' )) == false + - uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: install dependencies + run: | + pip install -U pip + pip install -U virtualenv tox + - name: install GHDL + if: endsWith( matrix.task, '-ghdl' ) + shell: bash + run: | + curl -fsSL -o ghdl.zip https://github.com/ghdl/ghdl/releases/download/v0.36/ghdl-0.36-mingw32-mcode.zip + 7z x ghdl.zip "-o../ghdl" -y + mv ../ghdl/GHDL/0.36-mingw32-mcode/ ../ghdl-v0.36 + rm -rf ../ghdl ghdl.zip + - name: run job + shell: bash + env: + TASK: ${{ matrix.task }} + run: | + export PATH=$PATH:$(pwd)/../ghdl-v0.36/bin + tox -e py${TASK} + + + # Deploy to PyPI whenever a release is pushed + # When a package version has not changed a new upload will not be triggered + deploy: + runs-on: ubuntu-latest + needs: [ lin, docker, win ] + if: github.event_name == 'release' && github.event.action == 'created' + steps: + - uses: actions/checkout@v1 + - name: git submodule update + run: git submodule update --init --recursive + - uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: install dependencies + run: | + pip install --upgrade pip + pip install setuptools wheel twine + - name: build and deploy to PyPI + env: + TWINE_USERNAME: ${{ secrets.PYPI_USER }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASS }} + run: | + python tools/release.py validate + #python setup.py sdist bdist_wheel + #twine upload dist/* + echo "This is a placeholder for deployment to PyPI" diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 401c5dbc33..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,86 +0,0 @@ -language: python -install: pip install tox -script: tox -e $BUILD_NAME - -stages: - - test - - deploy - -matrix: - include: - - &docker - env: - - BUILD_NAME=py27-acceptance-ghdl - - DOCKER_IMAGE=mcode-2 - services: docker - language: minimal - install: skip - script: docker run --rm -tv $(pwd):/src -w /src vunit/dev:$DOCKER_IMAGE tox -e $BUILD_NAME - - - <<: *docker - env: - - BUILD_NAME=py38-acceptance-ghdl - - DOCKER_IMAGE=llvm - - - <<: *docker - env: - - BUILD_NAME=py38-vcomponents-ghdl - - DOCKER_IMAGE=mcode - - - - env: BUILD_NAME=py38-fmt - python: '3.8' - script: tox -e $BUILD_NAME -- --check - - - - env: BUILD_NAME=py38-lint - dist: xenial - python: '3.8' - - - - env: BUILD_NAME=py27-unit - python: '2.7' - - env: BUILD_NAME=py35-unit - python: '3.5' - - env: BUILD_NAME=py38-unit - dist: xenial - python: '3.8' - - - - env: BUILD_NAME=py27-docs - python: '2.7' - before_script: git fetch --unshallow --tags - - env: BUILD_NAME=py38-docs - python: '3.8' - before_script: git fetch --unshallow --tags - after_success: touch .tox/${BUILD_NAME}/tmp/docsbuild/.nojekyll - deploy: - provider: pages - repo: VUnit/VUnit.github.io - target_branch: master - local_dir: .tox/${BUILD_NAME}/tmp/docsbuild/ - # This environment variable is set to an OAuth token in travis vunit settings - github_token: $GITHUB_PAGES_TOKEN - skip_cleanup: true - on: - repo: VUnit/vunit - branch: master - - # Deploy to PyPI whenever the package version has changed - # When a package version has not changed a new upload will not be triggered - - stage: deploy - python: '3.8' - if: tag IS present - script: - - git fetch --unshallow --tags - - python tools/release.py validate - deploy: - provider: pypi - distributions: sdist - skip_cleanup: true - skip_upload_docs: true - user: $PYPI_USER - password: $PYPI_PASSWORD - on: - repo: VUnit/vunit - all_branches: true