aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/main.yml
blob: d711f0f589626db30abebbd4e5fd33feabb482f1 (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
name: GitHub Actions

on:
  push:
    branches: [ next, master, actions ]
  pull_request:
    branches: [ next ]

jobs:
  build:
    name: build and test
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        compiler: [gcc, clang]
    env:
      CC: ${{ matrix.compiler }}
      DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
      DOCKER_EMAIL: ${{ secrets.DOCKER_EMAIL }}
      DOCKER_USER: ${{ secrets.DOCKER_USER }}
      GH_TOKEN: ${{ secrets.GH_TOKEN }}
      BALTO_TOKEN: ${{ secrets.BALTO_TOKEN }}

    steps:
    - uses: actions/checkout@v4
    - run: git fetch --prune --unshallow
    - name: construct container name
      run: |
        echo "BASENAME=i3wm/travis-base:$(date +'%Y-%m')-$(./travis/ha.sh travis/travis-base.Dockerfile)" >> $GITHUB_ENV
        echo "BASENAME_UBUNTU=i3wm/travis-base-ubuntu:$(date +'%Y-%m')-$(./travis/ha.sh travis/travis-base-ubuntu.Dockerfile)" >> $GITHUB_ENV
    - name: fetch or build Docker container
      run: |
        docker pull ${{ env.BASENAME }} || ./travis/docker-build-and-push.sh ${{ env.BASENAME }} travis/travis-base.Dockerfile
    - name: fetch or build extra Docker containers
      if: github.ref == 'refs/heads/next' && matrix.compiler == 'gcc'
      run: |
        docker pull ${{ env.BASENAME_UBUNTU }} || ./travis/docker-build-and-push.sh ${{ env.BASENAME_UBUNTU }} travis/travis-base-ubuntu.Dockerfile
    - name: build i3
      run: |
        docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${{ env.BASENAME }} /bin/sh -c 'rm -rf build; mkdir -p build && cd build && CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Werror -fno-common -D_FORTIFY_SOURCE=3" meson setup .. -Ddocs=true -Dmans=true -Db_sanitize=address --buildtype=debugoptimized && ninja -v'
    - name: check spelling
      run: |
        docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${{ env.BASENAME }} ./travis/check-spelling.pl
    - name: run i3 tests
      run: |
        docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${{ env.BASENAME }} ./travis/run-tests.sh
    - name: Archive test logs
      uses: actions/upload-artifact@v2
      with:
        name: test-logs
        path: build/testsuite-*
      if: ${{ failure() }}
    - name: build dist tarball
      run: |
        docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 -e CC ${{ env.BASENAME }} /bin/sh -c 'rm -rf distbuild; mkdir distbuild && cd distbuild && meson setup .. -Ddocs=true -Dmans=true && meson dist --no-tests'
    - name: build Debian packages
      if: github.ref == 'refs/heads/next' && matrix.compiler == 'gcc'
      run: |
        echo "::group::Debian amd64"
        docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${{ env.BASENAME }} ./travis/debian-build.sh deb/debian-amd64/DIST
        echo "::endgroup::"
        echo "::group::Ubuntu amd64"
        docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${{ env.BASENAME_UBUNTU }} ./travis/debian-build.sh deb/ubuntu-amd64/DIST
        echo "::endgroup::"
    - name: push Debian packages to balto
      if: github.ref == 'refs/heads/next' && matrix.compiler == 'gcc'
      run: |
        travis/push-balto.sh
    - name: build docs
      if: github.ref == 'refs/heads/next' && matrix.compiler == 'gcc'
      run: |
        docker run -v $PWD:/usr/src/i3/ -w /usr/src/i3 ${{ env.BASENAME }} ./travis/docs.sh
    - name: push docs to GitHub pages
      if: github.ref == 'refs/heads/next' && matrix.compiler == 'gcc'
      run: |
        travis/deploy-github-pages.sh
  formatting:
    name: Check formatting
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: check & print release notes
      run: ./release-notes/generator.pl
    - name: Install dependencies
      run: |
        sudo apt-get install -y clang-format-14
    - name: Check formatting
      run: clang-format-14 --dry-run --Werror $(git ls-files '*.c' '*.h')
    - name: Verify safe wrapper functions are used
      run: ./travis/check-safe-wrappers.sh