Welcome to mirror list, hosted at ThFree Co, Russian Federation.

build-test.yml « workflows « .github - NesTiler.git/NesTiler.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 916984d1909468d4d69ee6003f61937fafa4e185 (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
name: Build, test, upload

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  tests:
    strategy:
      matrix:
        host: [windows-latest, ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.host }}
    env:
      TESTS_PATH: ./Tests
      TESTS_CONFIGURATION: Debug
    steps:
    - name: Fix line endings
      run: git config --global core.autocrlf false
    - name: Checkout
      uses: actions/checkout@v3
    - name: Setup .NET
      uses: actions/setup-dotnet@v2
      with:
        dotnet-version: 6.0.x
    - name: Tests
      run: dotnet test ${{ env.TESTS_PATH }} -c ${{ env.TESTS_CONFIGURATION }}

  build:
    needs: [tests]
    strategy:
      matrix:
        host: [ubuntu-latest]
        os: [win, linux, osx]
        arch: [x86, x64, arm, arm64]
        sc: [no-self-contained, self-contained]
        exclude:
          - os: linux
            arch: x86
          - os: osx
            arch: x86
          - os: osx
            arch: arm          
    runs-on: ${{ matrix.host }}
    env:
      APP_NAME: nestiler
      PROJECT_PATH: ./NesTiler
      OUTPUT_DIR: output
      CONFIGURATION: Interim
      OUTPUT_SUBDIR: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.sc }}
      OUTPUT_FILE: nestiler-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.sc == 'self-contained' && '-self-contained' || '' }}.${{ matrix.os == 'win' && 'zip' || 'tar.gz' }}
    steps:
    - name: Fix line endings
      run: git config --global core.autocrlf false
    - name: Checkout
      uses: actions/checkout@v3
    - name: Setup .NET
      uses: actions/setup-dotnet@v2
      with:
        dotnet-version: 6.0.x
    - name: Build
      env:
        SC_OPS: ${{ matrix.sc == 'self-contained' && '--self-contained true -p:PublishTrimmed=True' || '--no-self-contained' }}
      run: dotnet publish ${{ env.PROJECT_PATH }} -c ${{ env.CONFIGURATION }} -r ${{ matrix.os }}-${{ matrix.arch }} ${{ env.SC_OPS }} -o ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_SUBDIR }}/${{ env.APP_NAME }}
    - name: Archive
      working-directory: ${{ env.OUTPUT_DIR }}/${{ env.OUTPUT_SUBDIR }}
      env:
        CMD: ${{ matrix.os == 'win' && 'zip -r9' || 'tar -czvf' }}
      run: |
        ${{ env.CMD }} ../../${{ env.OUTPUT_FILE }} ${{ env.APP_NAME }}
    - name: Upload artifact
      uses: actions/upload-artifact@v3
      with:
        name: ${{ env.OUTPUT_SUBDIR }}
        path: ${{ env.OUTPUT_FILE }}

  upload-to-pages:
    needs: [build, tests]
    runs-on: ubuntu-latest
    steps:
    - name: Download artifacts
      uses: actions/download-artifact@v3
    - name: Move files to the root
      run: find -mindepth 2 -exec mv {} . \;
    - name: Remove empty directories
      run: find -mindepth 1 -type d -delete
    - name: Generate index.html
      run: "(echo \"<html><head><title>NesTiler</title></head><body>Updated: `date`<br/><br/>\" ; for file in nestiler-* ; do echo \"<a href='$file'>$file</a><br/>\" ; done ; echo \"</body></html>\") > index.html"
    - name: Upload artifact
      uses: actions/upload-pages-artifact@v1
      with:
        path: '.'
    - name: Deploy to GitHub Pages
      id: deployment
      uses: actions/deploy-pages@v1