github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/.github/workflows/windows.yml (about)

     1  name: Windows
     2  
     3  on:
     4    pull_request:
     5    push:
     6      branches:
     7        - dev
     8        - release
     9  
    10  concurrency:
    11    group: ${{ github.workflow }}-${{ github.ref }}
    12    cancel-in-progress: true
    13  
    14  jobs:
    15    build-windows:
    16      runs-on: windows-2022
    17      steps:
    18        - name: Configure pagefile
    19          uses: al-cheb/configure-pagefile-action@v1.4
    20          with:
    21            minimum-size: 8GB
    22            maximum-size: 24GB
    23            disk-root: "C:"
    24        - uses: brechtm/setup-scoop@v2
    25          with:
    26            scoop_update: 'false'
    27        - name: Install Dependencies
    28          shell: bash
    29          run: |
    30            scoop install ninja binaryen
    31        - name: Checkout
    32          uses: actions/checkout@v4
    33          with:
    34            submodules: true
    35        - name: Install Go
    36          uses: actions/setup-go@v5
    37          with:
    38            go-version: '1.22'
    39            cache: true
    40        - name: Restore cached LLVM source
    41          uses: actions/cache/restore@v4
    42          id: cache-llvm-source
    43          with:
    44            key: llvm-source-17-windows-v1
    45            path: |
    46              llvm-project/clang/lib/Headers
    47              llvm-project/clang/include
    48              llvm-project/compiler-rt
    49              llvm-project/lld/include
    50              llvm-project/llvm/include
    51        - name: Download LLVM source
    52          if: steps.cache-llvm-source.outputs.cache-hit != 'true'
    53          run: make llvm-source
    54        - name: Save cached LLVM source
    55          uses: actions/cache/save@v4
    56          if: steps.cache-llvm-source.outputs.cache-hit != 'true'
    57          with:
    58            key: ${{ steps.cache-llvm-source.outputs.cache-primary-key }}
    59            path: |
    60              llvm-project/clang/lib/Headers
    61              llvm-project/clang/include
    62              llvm-project/compiler-rt
    63              llvm-project/lld/include
    64              llvm-project/llvm/include
    65        - name: Restore cached LLVM build
    66          uses: actions/cache/restore@v4
    67          id: cache-llvm-build
    68          with:
    69            key: llvm-build-17-windows-v1
    70            path: llvm-build
    71        - name: Build LLVM
    72          if: steps.cache-llvm-build.outputs.cache-hit != 'true'
    73          shell: bash
    74          run: |
    75            # fetch LLVM source
    76            rm -rf llvm-project
    77            make llvm-source
    78            # build!
    79            make llvm-build CCACHE=OFF
    80            # Remove unnecessary object files (to reduce cache size).
    81            find llvm-build -name CMakeFiles -prune -exec rm -r '{}' \;
    82        - name: Save cached LLVM build
    83          uses: actions/cache/save@v4
    84          if: steps.cache-llvm-build.outputs.cache-hit != 'true'
    85          with:
    86            key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
    87            path: llvm-build
    88        - name: Cache wasi-libc sysroot
    89          uses: actions/cache@v4
    90          id: cache-wasi-libc
    91          with:
    92            key: wasi-libc-sysroot-v5
    93            path: lib/wasi-libc/sysroot
    94        - name: Build wasi-libc
    95          if: steps.cache-wasi-libc.outputs.cache-hit != 'true'
    96          run: make wasi-libc
    97        - name: Install wasmtime
    98          run: |
    99            scoop install wasmtime@14.0.4
   100        - name: make gen-device
   101          run: make -j3 gen-device
   102        - name: Test TinyGo
   103          shell: bash
   104          run: make test GOTESTFLAGS="-short"
   105        - name: Build TinyGo release tarball
   106          shell: bash
   107          run: make build/release -j4
   108        - name: Make release artifact
   109          shell: bash
   110          working-directory: build/release
   111          run: 7z -tzip a release.zip tinygo
   112        - name: Publish release artifact
   113          # Note: this release artifact is double-zipped, see:
   114          # https://github.com/actions/upload-artifact/issues/39
   115          # We can essentially pick one of these:
   116          # - have a dobule-zipped artifact when downloaded from the UI
   117          # - have a very slow artifact upload
   118          # We're doing the former here, to keep artifact uploads fast.
   119          uses: actions/upload-artifact@v4
   120          with:
   121            name: windows-amd64-double-zipped
   122            path: build/release/release.zip
   123  
   124    smoke-test-windows:
   125      runs-on: windows-2022
   126      needs: build-windows
   127      steps:
   128        - name: Configure pagefile
   129          uses: al-cheb/configure-pagefile-action@v1.4
   130          with:
   131            minimum-size: 8GB
   132            maximum-size: 24GB
   133            disk-root: "C:"
   134        - uses: brechtm/setup-scoop@v2
   135          with:
   136            scoop_update: 'false'
   137        - name: Install Dependencies
   138          shell: bash
   139          run: |
   140            scoop install binaryen
   141        - name: Checkout
   142          uses: actions/checkout@v4
   143        - name: Install Go
   144          uses: actions/setup-go@v5
   145          with:
   146            go-version: '1.22'
   147            cache: true
   148        - name: Download TinyGo build
   149          uses: actions/download-artifact@v4
   150          with:
   151            name: windows-amd64-double-zipped
   152            path: build/
   153        - name: Unzip TinyGo build
   154          shell: bash
   155          working-directory: build
   156          run: 7z x release.zip -r
   157        - name: Smoke tests
   158          shell: bash
   159          run: make smoketest TINYGO=$(PWD)/build/tinygo/bin/tinygo
   160  
   161    stdlib-test-windows:
   162      runs-on: windows-2022
   163      needs: build-windows
   164      steps:
   165        - name: Configure pagefile
   166          uses: al-cheb/configure-pagefile-action@v1.4
   167          with:
   168            minimum-size: 8GB
   169            maximum-size: 24GB
   170            disk-root: "C:"
   171        - name: Checkout
   172          uses: actions/checkout@v4
   173        - name: Install Go
   174          uses: actions/setup-go@v5
   175          with:
   176            go-version: '1.22'
   177            cache: true
   178        - name: Download TinyGo build
   179          uses: actions/download-artifact@v4
   180          with:
   181            name: windows-amd64-double-zipped
   182            path: build/
   183        - name: Unzip TinyGo build
   184          shell: bash
   185          working-directory: build
   186          run: 7z x release.zip -r
   187        - name: Test stdlib packages
   188          run: make tinygo-test TINYGO=$(PWD)/build/tinygo/bin/tinygo
   189  
   190    stdlib-wasi-test-windows:
   191      runs-on: windows-2022
   192      needs: build-windows
   193      steps:
   194        - name: Configure pagefile
   195          uses: al-cheb/configure-pagefile-action@v1.4
   196          with:
   197            minimum-size: 8GB
   198            maximum-size: 24GB
   199            disk-root: "C:"
   200        - uses: brechtm/setup-scoop@v2
   201          with:
   202            scoop_update: 'false'
   203        - name: Install Dependencies
   204          shell: bash
   205          run: |
   206            scoop install binaryen && scoop install wasmtime@14.0.4
   207        - name: Checkout
   208          uses: actions/checkout@v4
   209        - name: Install Go
   210          uses: actions/setup-go@v5
   211          with:
   212            go-version: '1.22'
   213            cache: true
   214        - name: Download TinyGo build
   215          uses: actions/download-artifact@v4
   216          with:
   217            name: windows-amd64-double-zipped
   218            path: build/
   219        - name: Unzip TinyGo build
   220          shell: bash
   221          working-directory: build
   222          run: 7z x release.zip -r
   223        - name: Test stdlib packages on wasi
   224          run: make tinygo-test-wasi-fast TINYGO=$(PWD)/build/tinygo/bin/tinygo