From ae3a42dfcc17cfff73696870b07adac3a23e014c Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Mon, 25 Sep 2023 16:19:45 +0200 Subject: [PATCH] update CI from master --- .github/workflows/nightly.yml | 97 ---------------------------------- .github/workflows/releases.yml | 36 +++++++++---- .github/workflows/unittest.yml | 38 +++++++++++-- ci/validate_version.d | 10 +++- 4 files changed, 67 insertions(+), 114 deletions(-) delete mode 100644 .github/workflows/nightly.yml diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml deleted file mode 100644 index abcb380f..00000000 --- a/.github/workflows/nightly.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Deploy Nightly -on: - schedule: - - cron: '0 2 * * *' - -jobs: - nightly: - name: Deploy nightly - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] - arch: [x86_64] - include: - # use for 32 bit build - - os: windows-latest - arch: x86 - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v2 - - - name: Install D compiler - uses: dlang-community/setup-dlang@v1 - with: - compiler: ldc-latest - - - name: dub upgrade - uses: WebFreak001/dub-upgrade@v0.1.0 - - - name: Run tests - run: dub test - - # Linux release - - name: Build Linux release - run: ./ci/build.sh - if: matrix.os == 'ubuntu-latest' - env: - ARCH: ${{ matrix.arch }} - BUILD: release-debug - - - name: Deploy Linux release - if: matrix.os == 'ubuntu-latest' - uses: WebFreak001/deploy-nightly@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: https://uploads.github.com/repos/Pure-D/serve-d/releases/20717582/assets{?name,label} - release_id: 20717582 - asset_path: ./serve-d.tar.xz - asset_name: serve-d_linux-nightly-${{ matrix.arch }}-$$.tar.xz - asset_content_type: application/x-gtar - - # OSX release - - name: Build OSX release - run: ./ci/build.sh - if: matrix.os == 'macOS-latest' - env: - MACOSX_DEPLOYMENT_TARGET: '10.12' - ARCH: ${{ matrix.arch }} - BUILD: release-debug - - - name: Deploy OSX release - if: matrix.os == 'macOS-latest' - uses: WebFreak001/deploy-nightly@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: https://uploads.github.com/repos/Pure-D/serve-d/releases/20717582/assets{?name,label} - release_id: 20717582 - asset_path: ./serve-d.tar.xz - asset_name: serve-d_osx-nightly-${{ matrix.arch }}-$$.tar.xz - asset_content_type: application/x-gtar - - # Windows release - - name: Build Windows release - run: .\ci\build.bat - if: matrix.os == 'windows-latest' - env: - BUILD: release-debug - ARCH: ${{ matrix.arch }} - - - name: Deploy Windows release - if: matrix.os == 'windows-latest' - uses: WebFreak001/deploy-nightly@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: https://uploads.github.com/repos/Pure-D/serve-d/releases/20717582/assets{?name,label} - release_id: 20717582 - asset_path: ./serve-d.zip - asset_name: serve-d_windows-nightly-${{ matrix.arch }}-$$.zip - asset_content_type: application/zip - - - name: cache dependency binaries - uses: WebFreak001/dub-upgrade@v0.1.0 - with: - store: true diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index 372096b0..69a88c9f 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -9,41 +9,53 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macOS-latest] + # ubuntu / linux must run on kinda old linux for glibc compatibility! + os: [ubuntu-20.04, windows-latest, macos-latest] arch: [x86_64] include: # use for 32 bit build - os: windows-latest arch: x86 + - os: macos-latest + arch: arm64-apple-macos + arch_short: arm64 + cross: "1" runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 + - id: vars + shell: bash + run: | + if [ -z "${{matrix.arch_short}}" ]; then + echo "arch_short=${{matrix.arch}}" >> $GITHUB_OUTPUT + else + echo "arch_short=${{matrix.arch_short}}" >> $GITHUB_OUTPUT + fi + - name: Install D compiler uses: dlang-community/setup-dlang@v1 with: compiler: ldc-latest - - name: dub upgrade - uses: WebFreak001/dub-upgrade@v0.1.0 - - name: Run tests run: dub test # Linux release - name: Build Linux release run: ./ci/build.sh && rdmd ci/validate_version.d - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-20.04' env: ARCH: ${{ matrix.arch }} BUILD: release + CROSS: ${{ matrix.cross }} - name: Deploy Linux release - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu-20.04' uses: WebFreak001/upload-asset@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - OS: linux-${{ matrix.arch }} + OS: linux-${{ steps.vars.outputs.arch_short }} with: file: ./serve-d.tar.xz mime: application/x-gtar @@ -52,18 +64,19 @@ jobs: # OSX release - name: Build OSX release run: ./ci/build.sh && rdmd ci/validate_version.d - if: matrix.os == 'macOS-latest' + if: matrix.os == 'macos-latest' env: MACOSX_DEPLOYMENT_TARGET: '10.12' ARCH: ${{ matrix.arch }} BUILD: release + CROSS: ${{ matrix.cross }} - name: Deploy OSX release - if: matrix.os == 'macOS-latest' + if: matrix.os == 'macos-latest' uses: WebFreak001/upload-asset@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - OS: osx-${{ matrix.arch }} + OS: osx-${{ steps.vars.outputs.arch_short }} with: file: ./serve-d.tar.xz mime: application/x-gtar @@ -76,13 +89,14 @@ jobs: env: BUILD: release ARCH: ${{ matrix.arch }} + CROSS: ${{ matrix.cross }} - name: Deploy Windows release if: matrix.os == 'windows-latest' uses: WebFreak001/upload-asset@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - OS: windows-${{ matrix.arch }} + OS: windows-${{ steps.vars.outputs.arch_short }} with: file: ./serve-d.zip mime: application/zip diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index c0149ab7..2295133b 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -1,5 +1,9 @@ name: Run Unittests -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: jobs: dubtest: @@ -7,45 +11,71 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + # ubuntu / linux must run on kinda old linux for glibc compatibility! + os: [ubuntu-20.04, windows-latest, macos-latest] dc: [dmd-latest, ldc-latest] exclude: - os: windows-latest dc: dmd-latest + - os: macos-latest + dc: dmd-latest runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - name: Install D compiler uses: dlang-community/setup-dlang@v1 + timeout-minutes: 5 with: compiler: ${{ matrix.dc }} - - name: dub upgrade - run: dub upgrade + - name: Run workspace-d tests + run: dub test :workspace-d + timeout-minutes: 30 + env: + MACOSX_DEPLOYMENT_TARGET: '10.12' + + - name: serialization tests + run: dub test :protocol + timeout-minutes: 10 + env: + # shouldn't break other OSes + MACOSX_DEPLOYMENT_TARGET: '10.12' - name: LSP tests run: dub test :lsp + timeout-minutes: 10 env: # shouldn't break other OSes MACOSX_DEPLOYMENT_TARGET: '10.12' - name: serverbase tests run: dub test :serverbase + timeout-minutes: 10 env: MACOSX_DEPLOYMENT_TARGET: '10.12' - name: build minimal server run: dub build --root=null_server + timeout-minutes: 10 env: MACOSX_DEPLOYMENT_TARGET: '10.12' - name: test minimal server run: dub run --root=null_server_test + timeout-minutes: 10 env: MACOSX_DEPLOYMENT_TARGET: '10.12' - name: Run tests run: dub test + timeout-minutes: 30 + env: + MACOSX_DEPLOYMENT_TARGET: '10.12' + + - name: Run standalone tests + run: ./runtests.sh + working-directory: ./test + timeout-minutes: 30 env: MACOSX_DEPLOYMENT_TARGET: '10.12' diff --git a/ci/validate_version.d b/ci/validate_version.d index e7bbc7a1..11c59749 100644 --- a/ci/validate_version.d +++ b/ci/validate_version.d @@ -15,12 +15,18 @@ void main() else string served = "./serve-d"; + if (environment.get("CROSS").length) + { + writeln("Not checking if serve-d version is up-to-date because it's cross-compiled!"); + return; + } + auto res = execute([served, "--version"]); enforce(res.status == 0, "serve-d --version didn't return status 0"); string output = res.output.strip; - enforce(output.startsWith("serve-d v"), "serve-d --version didn't begin with `serve-d v`"); - output = output["serve-d v".length .. $]; + enforce(output.startsWith("serve-d standalone v"), "serve-d --version didn't begin with `serve-d standalone v`"); + output = output["serve-d standalone v".length .. $]; auto space = output.indexOfAny(" \t\r\n"); if (space != -1)