|
| 1 | +name: CI |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + release: |
| 8 | + types: [published] |
| 9 | + |
| 10 | +jobs: |
| 11 | + Build: |
| 12 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 17 | + dc: |
| 18 | + - ldc-latest |
| 19 | + - dmd-latest |
| 20 | + arch: |
| 21 | + - x86_64 |
| 22 | + include: |
| 23 | + # windows x86 |
| 24 | + - os: windows-latest |
| 25 | + arch: x86 |
| 26 | + dc: ldc-latest |
| 27 | + runs-on: ${{ matrix.os }} |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v2 |
| 30 | + with: |
| 31 | + submodules: recursive |
| 32 | + |
| 33 | + - name: Setup D |
| 34 | + uses: dlang-community/setup-dlang@v1 |
| 35 | + with: |
| 36 | + compiler: ${{ matrix.dc }} |
| 37 | + |
| 38 | + # Build |
| 39 | + |
| 40 | + - name: Build |
| 41 | + run: | |
| 42 | + dub build --build=release --config=client --arch=${{ matrix.arch }} |
| 43 | + dub build --build=release --config=server --arch=${{ matrix.arch }} |
| 44 | +
|
| 45 | + # Tests |
| 46 | + |
| 47 | + - name: Linux Tests |
| 48 | + if: contains(matrix.os, 'ubuntu') |
| 49 | + run: | |
| 50 | + ./run_tests.sh |
| 51 | + working-directory: tests |
| 52 | + shell: bash |
| 53 | + |
| 54 | + - name: Windows and MacOS Tests |
| 55 | + if: contains(matrix.os, 'windows') || contains(matrix.os, 'macos') |
| 56 | + run: | |
| 57 | + ./run_tests.sh |
| 58 | + working-directory: tests |
| 59 | + shell: bash |
| 60 | + continue-on-error: true |
| 61 | + |
| 62 | + |
| 63 | + # Package Release |
| 64 | + |
| 65 | + - name: Package the artificats |
| 66 | + if: github.event_name == 'release' && contains(matrix.dc, 'ldc') |
| 67 | + shell: pwsh |
| 68 | + run: | |
| 69 | + if ("${{ matrix.os }}" -like 'windows*') { |
| 70 | + 7z a -tzip dcd.zip dcd-client.exe dcd-server.exe |
| 71 | + } else { |
| 72 | + tar -cvzf dcd.tar.gz dcd-client dcd-server |
| 73 | + } |
| 74 | +
|
| 75 | + # Release |
| 76 | + |
| 77 | + - name: Release Linux |
| 78 | + if: github.event_name == 'release' && contains(matrix.os, 'ubuntu') && contains(matrix.dc, 'ldc') |
| 79 | + uses: WebFreak001/upload-asset@v1.0.0 |
| 80 | + env: |
| 81 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + OS: linux |
| 83 | + with: |
| 84 | + file: dcd.tar.gz |
| 85 | + filename: dcd-${TAG_RAW}-${OS}-${{ matrix.arch }}.tar.gz |
| 86 | + mime: application/tar+gzip |
| 87 | + |
| 88 | + - name: Release Macos |
| 89 | + if: github.event_name == 'release' && contains(matrix.os, 'macos') && contains(matrix.dc, 'ldc') |
| 90 | + uses: WebFreak001/upload-asset@v1.0.0 |
| 91 | + env: |
| 92 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + OS: osx |
| 94 | + with: |
| 95 | + file: dcd.tar.gz |
| 96 | + filename: dcd-${TAG_RAW}-${OS}-${{ matrix.arch }}.tar.gz |
| 97 | + mime: application/tar+gzip |
| 98 | + |
| 99 | + - name: Release Windows |
| 100 | + if: github.event_name == 'release' && contains(matrix.os, 'windows') && contains(matrix.dc, 'ldc') |
| 101 | + uses: WebFreak001/upload-asset@v1.0.0 |
| 102 | + env: |
| 103 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 104 | + OS: windows |
| 105 | + with: |
| 106 | + file: dcd.zip |
| 107 | + filename: dcd-${TAG_RAW}-${OS}-${{ matrix.arch }}.zip |
| 108 | + mime: application/zip |
0 commit comments