name: CI on: [push, pull_request] jobs: build: if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository strategy: fail-fast: false matrix: config: - { os: ubuntu-20.04, platform: x64, cxx: g++-10, cc: gcc-10 } - { os: macos-11, platform: x64, cxx: clang++, cc: clang } - { os: windows-2019, platform: x64, vs: msvc } runs-on: ${{ matrix.config.os }} env: CC: ${{ matrix.config.cc }} CXX: ${{ matrix.config.cxx }} PLATFORM: ${{ matrix.config.platform }} DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true steps: - uses: actions/checkout@v2 with: fetch-depth: '0' - name: Install nbgv if: startsWith(matrix.config.os, 'macos') run: | dotnet tool install -g nbgv - name: Set version run: nbgv cloud --all-vars - name: Environment if: matrix.config.vs shell: bash run: echo "/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin" >> $GITHUB_PATH - name: Setup shell: bash run: | build/build.sh generate -platform $PLATFORM build/build.sh download_llvm -platform $PLATFORM - name: Restore shell: bash run: build/build.sh restore -platform $PLATFORM - name: Build shell: bash run: build/build.sh -platform $PLATFORM -build_only - name: Test shell: bash run: build/test.sh -platform $PLATFORM - name: Pack shell: bash run: build/build.sh prepack -platform $PLATFORM - uses: actions/upload-artifact@v2 with: name: intermediate path: | artifacts include/**/*.h create_package: runs-on: windows-2019 needs: build if: | (github.event_name == 'push' && (github.ref == 'refs/heads/main' || contains(github.ref, 'nuget'))) || (github.event.pull_request.head.repo.full_name != github.repository && contains(github.event.pull_request.head.ref, 'nuget')) env: DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true steps: - uses: actions/checkout@v2 with: fetch-depth: '0' - name: Set version run: nbgv cloud --all-vars - uses: actions/download-artifact@v2 with: name: intermediate - name: Setup shell: bash run: build/build.sh generate_config - name: Create package shell: bash run: build/build.sh pack - name: Upload package uses: actions/upload-artifact@v2 with: name: CppSharp.nupkg path: | artifacts/*.nupkg - name: Upload package to GitHub Packages run: | cd artifacts dotnet nuget add source --username tritao --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/tritao/index.json" dotnet nuget push "*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --source "github" --skip-duplicate