Boiling it down to one CI workflow, with conditional deploy (deploy/release branch)

This commit is contained in:
James Barnsley
2021-10-27 21:08:43 +13:00
parent cfd373d3aa
commit 97e88ca6fe
3 changed files with 6 additions and 80 deletions

View File

@ -2,10 +2,10 @@ name: Release
on: on:
push: push:
branches: [deploy/release] branches: [master,develop,deploy/release]
jobs: jobs:
jest-tests: jest:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -23,7 +23,7 @@ jobs:
- name: Submit to Codecov - name: Submit to Codecov
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v1
tox-tests: tox:
strategy: strategy:
fail-fast: false fail-fast: false
@ -74,9 +74,11 @@ jobs:
- uses: codecov/codecov-action@v1 - uses: codecov/codecov-action@v1
if: ${{ matrix.coverage }} if: ${{ matrix.coverage }}
build-and-push-docker-image: deploy:
name: Build and publish to PyPi and DockerHub name: Build and publish to PyPi and DockerHub
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [jest-tests, tox-tests]
if: github.ref == 'refs/heads/deploy/release'
steps: steps:
- name: Checkout code - name: Checkout code

View File

@ -1,22 +0,0 @@
name: Jest tests
on:
- push
- pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12'
- name: Install modules
run: npm ci
- name: Run tests
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
run: npm run test
- name: Submit to Codecov
uses: codecov/codecov-action@v1

View File

@ -1,54 +0,0 @@
name: Python tests
on:
- push
- pull_request
jobs:
main:
strategy:
fail-fast: false
matrix:
include:
- name: "Test: Python 3.7"
python: "3.7"
tox: py37
coverage: true
- name: "Test: Python 3.8"
python: "3.8"
tox: py38
- name: "Test: Python 3.9"
python: "3.9"
tox: py39
- name: "Lint: check-manifest"
python: "3.9"
tox: check-manifest
- name: "Lint: flake8"
python: "3.9"
tox: flake8
name: ${{ matrix.name }}
runs-on: ubuntu-20.04
container: ghcr.io/mopidy/ci:latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Fix home dir permissions to enable pip caching
run: chown -R root /github/home
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python }}-${{ matrix.tox }}-pip-${{ hashFiles('setup.cfg') }}-${{ hashFiles('tox.ini') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python }}-${{ matrix.tox }}-pip-
- run: python -m pip install pygobject tox
- run: python -m tox -e ${{ matrix.tox }}
if: ${{ ! matrix.coverage }}
- run: python -m tox -e ${{ matrix.tox }} -- --cov-report=xml
if: ${{ matrix.coverage }}
- uses: codecov/codecov-action@v1
if: ${{ matrix.coverage }}