summaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/test.yml
blob: 9fe846d1869724bb0c2b5c61498ef1cdf4de23e2 (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
name: Test

on:
  push:
    paths-ignore:
      - '**.md'
  schedule:
    # Weekly, at 00:30 UTC on Friday (somewhat randomly chosen).
    - cron: '30 00 * * 5'
  workflow_dispatch:

permissions: {}

jobs:
  test:
    strategy:
      # It's much easier to re-run as few jobs as possible:
      fail-fast: false
      matrix:
        platform: [x86, x64]
        os: [ubuntu-22.04, ubuntu-24.04, ubuntu-latest, windows-2022, windows-2025, windows-latest]
    runs-on: ${{ matrix.os }}
    name: |
      Test: ${{ matrix.os }} / ${{ matrix.platform }}
    defaults:
      run:
        shell: pwsh
    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          persist-credentials: false
      - name: Clean up PATH
        uses: egor-tensin/cleanup-path@v5
        if: runner.os == 'Windows'
      - name: Set up MinGW
        id: setup
        uses: $/
        with:
          platform: ${{ matrix.platform }}
          cc: 1
      - name: Build threads.exe
        env:
          GXX: ${{ steps.setup.outputs.gxx }}
        run: |
          & $env:GXX -std=c++14 -o (Join-Path . test threads) (Join-Path . test threads.cpp)
      - name: Run threads.exe
        uses: $/.github/actions/run-threads
        if: runner.os == 'Windows'
      - name: Check cc/c++
        uses: $/.github/actions/check-cc

  test_windows_versions:
    strategy:
      matrix:
        version:
          - 8.1.0
          - 12.2.0
          - 15.2.0
    runs-on: windows-latest
    name: |
      Version: ${{ matrix.version }}
    defaults:
      run:
        shell: pwsh
    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          persist-credentials: false
      - name: Clean up PATH
        uses: egor-tensin/cleanup-path@v5
      - name: Set up MinGW
        id: setup
        uses: $/
        with:
          version: ${{ matrix.version }}
      - name: Verify the version
        uses: $/.github/actions/check-cc
        with:
          version: ${{ matrix.version }}
      - name: Build threads.exe
        env:
          GXX: ${{ steps.setup.outputs.gxx }}
        run: |
          & $env:GXX -std=c++14 -o (Join-Path . test threads) (Join-Path . test threads.cpp)
      - name: Run threads.exe
        uses: $/.github/actions/run-threads

  release:
    if: github.ref_type == 'tag'
    name: Release
    runs-on: ubuntu-latest
    needs:
      - test
      - test_windows_versions
    permissions:
      contents: write
    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          persist-credentials: false
      - name: Release
        uses: softprops/action-gh-release@v3