summaryrefslogtreecommitdiffstats
path: root/.github/workflows/asciinema.yml
blob: 4eb53557639c2ee85fde9a931f53730a17011bdb (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
name: build
on:
  - push
  - pull_request
jobs:
  # Code style checks
  health:
    name: code health check
    runs-on: ubuntu-latest
    steps:
      - name: checkout asciinema
        uses: actions/checkout@v4
      - name: setup Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.10"
      - name: install dependencies
        run: pip install build cmarkgfm pycodestyle twine
      - name: Run pycodestyle
        run: >
          find .
          -name '*\.py'
          -exec pycodestyle --ignore=E402,E501,E722,W503 "{}" \+
      - name: Run twine
        run: |
          python3 -m build
          twine check dist/*
  # Asciinema checks
  asciinema:
    name: Asciinema
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python:
          - "3.7"
          - "3.8"
          - "3.9"
          - "3.10"
          - "3.11"
    env:
      TERM: dumb
    steps:
      - name: checkout Asciinema
        uses: actions/checkout@v4
      - name: setup Python
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python }}
      - name: install dependencies
        run: pip install pytest
      - name: run Asciinema tests
        run: script -e -c make test
  build_distros:
    name: build distro images
    strategy:
      matrix:
        distros:
          - alpine
          - arch
          - debian
          - fedora
          - ubuntu
    runs-on: ubuntu-latest
    steps:
      - name: Set up Docker buildx
        id: buildx
        uses: docker/setup-buildx-action@v3
      - name: Authenticate to GHCR
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: "${{ github.actor }}"
          password: "${{ secrets.GITHUB_TOKEN }}"
      - name: "Build ${{ matrix.distros }} image"
        uses: docker/build-push-action@v5
        with:
          file: "tests/distros/Dockerfile.${{ matrix.distros }}"
          tags: |
            "ghcr.io/${{ github.repository }}:${{ matrix.distros }}"
          push: true
  test_distros:
    name: integration test distro images
    needs: build_distros
    strategy:
      matrix:
        distros:
          - alpine
          - arch
          - debian
          - fedora
          - ubuntu
    runs-on: ubuntu-latest
    container:
      image: "ghcr.io/${{ github.repository }}:${{ matrix.distros }}"
      credentials:
        username: "${{ github.actor }}"
        password: "${{ secrets.GITHUB_TOKEN }}"
      # https://github.community/t/permission-problems-when-checking-out-code-as-part-of-github-action/202263
      options: "--interactive --tty --user=1001:121"
    steps:
      - name: checkout Asciinema
        uses: actions/checkout@v4
      - name: run integration tests
        env:
          TERM: dumb
        shell: 'script --return --quiet --command "bash {0}"'
        run: make test.integration