|
| 1 | +name: Beep |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["beeper"] |
| 6 | + pull_request: |
| 7 | + |
| 8 | + |
| 9 | +jobs: |
| 10 | + lint: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v2 |
| 14 | + - uses: actions/setup-python@v2 |
| 15 | + - run: pip install poetry |
| 16 | + - run: poetry install --extras all |
| 17 | + - run: poetry run isort --check synapse |
| 18 | + - run: poetry run black --check synapse |
| 19 | + - run: poetry run mypy |
| 20 | + |
| 21 | + # Tests |
| 22 | + |
| 23 | + test-trial: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + needs: lint |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v2 |
| 28 | + - uses: actions/setup-python@v2 |
| 29 | + - run: pip install poetry |
| 30 | + - run: poetry install --extras all |
| 31 | + - run: poetry run trial -j4 tests |
| 32 | + |
| 33 | + test-sytest: |
| 34 | + needs: lint |
| 35 | + runs-on: ubuntu-latest |
| 36 | + container: |
| 37 | + image: matrixdotorg/sytest-synapse:buster |
| 38 | + volumes: |
| 39 | + - ${{ github.workspace }}:/src |
| 40 | + env: |
| 41 | + SYTEST_BRANCH: ${{ github.head_ref }} |
| 42 | + TOP: ${{ github.workspace }} |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v2 |
| 46 | + - name: Run SyTest |
| 47 | + run: /bootstrap.sh synapse |
| 48 | + working-directory: /src |
| 49 | + - name: Summarise results.tap |
| 50 | + if: ${{ always() }} |
| 51 | + run: /sytest/scripts/tap_to_gha.pl /logs/results.tap |
| 52 | + - name: Upload SyTest logs |
| 53 | + uses: actions/upload-artifact@v2 |
| 54 | + if: ${{ always() }} |
| 55 | + with: |
| 56 | + name: Sytest Logs - ${{ job.status }} - (${{ join(matrix.*, ', ') }}) |
| 57 | + path: | |
| 58 | + /logs/results.tap |
| 59 | + /logs/**/*.log* |
| 60 | +
|
| 61 | + # Builds |
| 62 | + |
| 63 | + build-python: |
| 64 | + needs: |
| 65 | + - test-trial |
| 66 | + - test-sytest |
| 67 | + runs-on: ubuntu-latest |
| 68 | + env: |
| 69 | + DOCKER_BUILDKIT: 1 |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v2 |
| 72 | + - uses: docker/setup-buildx-action@v2 |
| 73 | + - run: docker login -u ${{ secrets.CI_REGISTRY_USER }} -p ${{ secrets.CI_REGISTRY_PASSWORD }} ${{ secrets.CI_REGISTRY }} |
| 74 | + - run: |- |
| 75 | + if [ "${{ github.ref_name }}" = "beeper" ]; then |
| 76 | + tag=$(cat pyproject.toml | grep -E "^version =" | sed -E 's/^version = "(.+)"$/\1/'); |
| 77 | + else |
| 78 | + tag="${{ github.ref_name }}"; |
| 79 | + fi |
| 80 | +
|
| 81 | + docker build --tag ${{ secrets.CI_REGISTRY }}/synapse:$tag-${{ github.sha }} -f docker/Dockerfile . |
| 82 | + docker push ${{ secrets.CI_REGISTRY }}/synapse:$tag-${{ github.sha }} |
| 83 | +
|
| 84 | + if [ "${{ github.ref_name }}" = "beeper" ]; then |
| 85 | + docker tag \ |
| 86 | + ${{ secrets.CI_REGISTRY }}/synapse:$tag-${{ github.sha }} \ |
| 87 | + ${{ secrets.CI_REGISTRY }}/synapse:latest |
| 88 | + docker push ${{ secrets.CI_REGISTRY }}/synapse:latest |
| 89 | + fi |
| 90 | +
|
| 91 | + build-pyston: |
| 92 | + needs: |
| 93 | + - test-trial |
| 94 | + - test-sytest |
| 95 | + runs-on: ubuntu-latest |
| 96 | + env: |
| 97 | + DOCKER_BUILDKIT: 1 |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v2 |
| 100 | + - uses: docker/setup-buildx-action@v2 |
| 101 | + - run: docker login -u ${{ secrets.CI_REGISTRY_USER }} -p ${{ secrets.CI_REGISTRY_PASSWORD }} ${{ secrets.CI_REGISTRY }} |
| 102 | + - run: |- |
| 103 | + if [ "${{ github.ref_name }}" = "beeper" ]; then |
| 104 | + tag=$(cat pyproject.toml | grep -E "^version =" | sed -E 's/^version = "(.+)"$/\1/'); |
| 105 | + else |
| 106 | + tag="${{ github.ref_name }}"; |
| 107 | + fi |
| 108 | +
|
| 109 | + docker build \ |
| 110 | + --build-arg BASE_IMAGE=pyston/slim:2.3.3 \ |
| 111 | + --tag ${{ secrets.CI_REGISTRY }}/synapse:$tag-${{ github.sha }}-pyston \ |
| 112 | + -f docker/Dockerfile-custom-base . |
| 113 | +
|
| 114 | + docker push ${{ secrets.CI_REGISTRY }}/synapse:$tag-${{ github.sha }}-pyston |
0 commit comments