Merge pull request #25 from m-carrasco/fix-nuget-issue #176
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: .NET (build, test and release if necessary) | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Checkout LFS objects | |
run: git lfs checkout | |
- name: Setup Python | |
uses: actions/setup-python@v2.2.2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Install Souffle | |
run: brew install --HEAD souffle-lang/souffle/souffle | |
- name: Build Souffle program | |
run: | | |
cd $GITHUB_WORKSPACE/souffle && CXX=clang++ ./build-souffle-macos-x86-64-arm64.sh | |
- name: Build dotnet | |
run: | | |
dotnet build | |
dotnet test --verbosity normal | |
- name: Upload ssa-query-macos-x86-64-arm64 | |
# only do it when it hits the default branch | |
# this artifact is consumed by the release job | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ssa-query-macos-x86-64-arm64 | |
path: ${{ github.workspace }}/souffle/bin/macos-x86-64-arm64/ssa-query-macos-x86-64-arm64 | |
retention-days: 1 | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Checkout LFS objects | |
run: git lfs checkout | |
- name: Setup Python | |
uses: actions/setup-python@v2.2.2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Build dotnet | |
run: | | |
dotnet build | |
dotnet test --verbosity normal | |
build-linux: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Checkout LFS objects | |
run: git lfs checkout | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.7 | |
with: | |
versionSpec: '5.x' | |
- name: Calculate version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0.9.7 | |
with: | |
useConfigFile: true | |
configFilePath: ${{ github.workspace }}/.github/GitVersion.yml | |
- name: Setup Python | |
uses: actions/setup-python@v2.2.2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v1.9 | |
with: | |
cmake-version: '3.21.x' | |
- name: Setup dependencies | |
run: | | |
sudo ./ci/install-lit.sh | |
sudo ./ci/install-llvm.sh | |
sudo ./ci/install-mono.sh | |
- name: Build Souffle programs from scratch | |
run: | | |
cd $GITHUB_WORKSPACE/souffle && rm -r bin/ && ./build-all-with-docker.sh | |
- name: Build dotnet | |
run: | | |
dotnet build | |
dotnet test --verbosity normal | |
lit integration-test -v | |
release: | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
needs: [build-macos, build-windows, build-linux] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Checkout LFS objects | |
run: git lfs checkout | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.7 | |
with: | |
versionSpec: '5.x' | |
- name: Calculate version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0.9.7 | |
with: | |
useConfigFile: true | |
configFilePath: ${{ github.workspace }}/.github/GitVersion.yml | |
- name: Setup Python | |
uses: actions/setup-python@v2.2.2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Build Souffle programs from scratch | |
run: | | |
cd $GITHUB_WORKSPACE/souffle && rm -r bin/ && ./build-all-with-docker.sh | |
- name: Fetch macos binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: ssa-query-macos-x86-64-arm64 | |
path: ${{ github.workspace }}/souffle/bin/macos-x86-64-arm64/ | |
- name: Build dotnet | |
run: | | |
dotnet build | |
dotnet test --verbosity normal | |
- name: Generate nuget packages | |
run: | | |
./ci/nuget-pack.sh "${{ steps.gitversion.outputs.AssemblySemVer }}" "${{ steps.gitversion.outputs.AssemblySemVer }}" "${{ steps.gitversion.outputs.InformationalVersion }}" "${{ steps.gitversion.outputs.AssemblySemVer }}" | |
dotnet nuget push build/bin/net-ssa/package/net-ssa-lib.${{ steps.gitversion.outputs.NuGetVersionV2 }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
mirror: | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
needs: [build-macos, build-windows, build-linux] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Checkout LFS objects | |
run: git lfs checkout | |
- name: Push to Bitbucket | |
run: git push "https://${{ secrets.BITBUCKET_MIRROR_USER }}:${{ secrets.BITBUCKET_MIRROR_PASSWORD }}@bitbucket.org/m-carrasco/net-ssa-mirror.git" --all --force |