aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/windows-ci.yml
blob: c89eb605d464b6f99c4b74cb0c0941a732e2b3e6 (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
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
109
110
111
112
113
114
115
#############################################################################
#
# Author: Jia Tan
#
# This file has been put into the public domain.
# You can do whatever you want with this file.
#
#############################################################################

name: Windows-CI

# Only run the Windows CI manually since it takes much longer than the others.
on: workflow_dispatch

jobs:
  POSIX:
    strategy:
      matrix:
        # Test different environments since the code may change between
        # them and we want to ensure that we support all potential users.
        # clang64 currently fails due to a warning, so support will be
        # added later.
        msys2_env: [mingw64, mingw32, ucrt64, clang64, msys]

    # Set the shell to be msys2 as a default to avoid setting it for
    # every individual run command.
    defaults:
      run:
        shell: msys2 {0}

    runs-on: windows-latest

    steps:
      #####################
      # Setup Environment #
      #####################

      # Rely on the msys2 GitHub Action to set up the msys2 environment.
      - name: Setup MSYS2
        uses: msys2/setup-msys2@v2
        with:
          msystem: ${{ matrix.msys2_env }}
          update: true
          install: pactoys

      - name: Checkout code
        # Need to explicitly set the shell here since we set the default
        # shell as msys2 earlier. This avoids an extra msys2 dependency on
        # git.
        shell: powershell
        # Avoid Windows line endings. Otherwise test_scripts.sh will fail
        # because the expected output is stored in the test framework as a
        # text file and will not match the output from xzgrep.
        run: git config --global core.autocrlf false

      - uses: actions/checkout@v3


      ########################
      # Install Dependencies #
      ########################

        # The pacman repository has a different naming scheme for default
        # msys packages than the others. The pacboy tool allows installing
        # the packages possible in matrix setup without a burdensome amount
        # of ifs.
      - name: Install Dependencies
        if: ${{ matrix.msys2_env == 'msys' }}
        run: pacman --noconfirm -S --needed autotools base-devel doxygen gettext-devel gcc

      - name: Install Dependencies
        if: ${{ matrix.msys2_env != 'msys' }}
        run: pacboy --noconfirm -S --needed autotools:p gcc:p clang:p make:p doxygen:p


      ##################
      # Build and Test #
      ##################

      - name: Build with full features
        run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -p build
      - name: Test with full features
        run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -p test -n full_features

      - name: Build without threads
        run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d threads,shared -p build
      - name: Test without threads
        run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d threads,shared -p test -n no_threads

      - name: Build without encoders
        run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d encoders,shared -p build
      - name: Test without encoders
        run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d encoders,shared -p test -n no_encoders

      - name: Build without decoders
        run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d decoders,shared -p build
      - name: Test without decoders
        run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -d decoders,shared -p test -n no_decoders

      - name: Build with only crc32 check
        run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -c crc32 -d shared,nls -p build
      - name: Test with only crc32 check
        run: ./build-aux/ci_build.sh -a "--no-po4a" -b autotools -c crc32 -d shared,nls -p test -n crc32_only


      ###############
      # Upload Logs #
      ###############

      # Upload the test logs as artifacts if any step has failed.
      - uses: actions/upload-artifact@v3
        if: ${{ failure() }}
        with:
          name: ${{ matrix.msys2_env }} ${{ matrix.build_system }} Test Logs
          path: build-aux/artifacts