aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/test.yml
blob: 156cd2d95a2f171467581e85e9cf30e9dc1c224f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Test

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  local:
    runs-on: ubuntu-18.04
    strategy:
      matrix:
        python-version: [3.6, 3.7, 3.8, 3.9]
    name: 'Test locally / ${{ matrix.python-version }}'
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: '${{ matrix.python-version }}'
      - name: Initialize Git
        run: |
          git config --global user.name 'John Doe'
          git config --global user.email 'John.Doe@example.com'
      - name: Run the tests
        run: ./.ci/local/test.sh

  docker:
    runs-on: ubuntu-18.04
    name: Test in Docker
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Run the tests
        run: ./.ci/docker/test.sh

  publish:
    needs: [local, docker]
    runs-on: ubuntu-18.04
    name: Publish
    if: github.ref == 'refs/heads/master'
    steps:
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      - name: Login to Docker Hub
        uses: docker/login-action@v1
        with:
          username: '${{ secrets.DOCKERHUB_USERNAME }}'
          password: '${{ secrets.DOCKERHUB_TOKEN }}'
      - name: Build and publish
        uses: docker/build-push-action@v2
        with:
          platforms: linux/amd64,linux/armhf
          push: true
          tags: '${{ secrets.DOCKERHUB_USERNAME }}/cgit-repos:latest'