|
| 1 | +name: "CodeQL" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main, dev] |
| 6 | + pull_request: |
| 7 | + # The branches below must be a subset of the branches above |
| 8 | + branches: [main] |
| 9 | + schedule: |
| 10 | + - cron: '0 19 * * 0' |
| 11 | + |
| 12 | +env: |
| 13 | + VERSION: '' |
| 14 | + BRANCH: '' |
| 15 | + |
| 16 | +jobs: |
| 17 | + analyse: |
| 18 | + name: Analyse |
| 19 | + runs-on: ubuntu-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout repository |
| 23 | + uses: actions/checkout@v2 |
| 24 | + with: |
| 25 | + # We must fetch at least the immediate parents so that if this is |
| 26 | + # a pull request then we can checkout the head. |
| 27 | + fetch-depth: 2 |
| 28 | + |
| 29 | + # If this run was triggered by a pull request event, then checkout |
| 30 | + # the head of the pull request instead of the merge commit. |
| 31 | + - run: git checkout HEAD^2 |
| 32 | + if: ${{ github.event_name == 'pull_request' }} |
| 33 | + |
| 34 | + # Initializes the CodeQL tools for scanning. |
| 35 | + - name: Initialize CodeQL |
| 36 | + uses: github/codeql-action/init@v1 |
| 37 | + # Override language selection by uncommenting this and choosing your languages |
| 38 | + with: |
| 39 | + languages: csharp |
| 40 | + |
| 41 | + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). |
| 42 | + # If this step fails, then you should remove it and run the build manually (see below) |
| 43 | + #- name: Autobuild |
| 44 | + # uses: github/codeql-action/autobuild@v1 |
| 45 | + |
| 46 | + # ℹ️ Command-line programs to run using the OS shell. |
| 47 | + # 📚 https://git.io/JvXDl |
| 48 | + |
| 49 | + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines |
| 50 | + # and modify them (or add more) to build your code if your project |
| 51 | + # uses a compiled language |
| 52 | + |
| 53 | + #- run: | |
| 54 | + # make bootstrap |
| 55 | + # make release |
| 56 | + - uses: dotnet/nbgv@master |
| 57 | + with: |
| 58 | + setAllVars: true |
| 59 | + - name: Setting VERSION and BRANCH env |
| 60 | + run: | |
| 61 | + echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion" |
| 62 | + echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" |
| 63 | + - name: Update tokens in project files |
| 64 | + uses: cschleiden/replace-tokens@v1 |
| 65 | + with: |
| 66 | + files: '["*.csproj", "**/*.csproj"]' |
| 67 | + - uses: actions/setup-dotnet@v1 |
| 68 | + with: |
| 69 | + dotnet-version: '3.1.202' |
| 70 | + |
| 71 | + - name: Building library |
| 72 | + run: | |
| 73 | + dotnet restore src |
| 74 | + dotnet build src/bunit.core/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true |
| 75 | + dotnet build src/bunit.web/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true |
| 76 | + dotnet build src/bunit.xunit/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true |
| 77 | + dotnet build src/bunit.testassets/ -c Release --no-restore |
| 78 | + |
| 79 | + - name: Perform CodeQL Analysis |
| 80 | + uses: github/codeql-action/analyze@v1 |
0 commit comments