wip #136
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main, wip] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| CI_VERSION: 0.0.${{ github.run_number }} | |
| CI_INFORMATIONAL_VERSION: 0.0.${{ github.run_number }}+${{ github.sha }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '9.x' | |
| - name: Restore dependencies | |
| run: dotnet restore files.sln | |
| - name: Lint UI hardcodes (changed files) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| BASE_SHA="${{ github.event.pull_request.base.sha }}" | |
| else | |
| BASE_SHA="${{ github.event.before }}" | |
| if [[ -z "$BASE_SHA" || "$BASE_SHA" == "0000000000000000000000000000000000000000" ]]; then | |
| BASE_SHA="$(git rev-parse HEAD~1)" | |
| fi | |
| fi | |
| mapfile -t CHANGED_FILES < <(git diff --name-only --diff-filter=ACMRTUXB "$BASE_SHA" "${{ github.sha }}") | |
| if [[ ${#CHANGED_FILES[@]} -eq 0 ]]; then | |
| echo "[ci] no changed files to lint" | |
| exit 0 | |
| fi | |
| chmod +x scripts/lint-ui-hardcodes.sh | |
| ./scripts/lint-ui-hardcodes.sh "${CHANGED_FILES[@]}" | |
| - name: Build | |
| run: dotnet build files.sln --no-restore -p:Version=$CI_VERSION -p:InformationalVersion=$CI_INFORMATIONAL_VERSION | |
| - name: Test | |
| run: dotnet test files.sln --no-build --verbosity normal |