This repository was archived by the owner on Dec 27, 2024. It is now read-only.
ADHOC: Lint the code, then format it #3
Workflow file for this run
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: Build and Test | |
| on: | |
| pull_request: | |
| paths: | |
| - .github/workflows/build-and-test.yml | |
| - go.mod | |
| - go.sum | |
| - '**/*.go' | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| # runs-on: ${{ matrix.platform }} | |
| # strategy: | |
| # matrix: | |
| # platform: | |
| # - ubuntu-latest | |
| # - macos-latest | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Generate token | |
| id: generate-token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ vars.APP_ID }} | |
| private-key: ${{ secrets.APP_KEY }} | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| token: ${{ steps.generate-token.outputs.token }} | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.23.4 | |
| - name: Install dependencies | |
| run: go mod tidy | |
| - name: Lint | |
| uses: golangci/golangci-lint-action@v6 | |
| with: | |
| version: v1.60 | |
| - name: Build | |
| run: make build | |
| - name: Commit | |
| if: ${{ github.ref != 'refs/heads/main' }} | |
| id: commit | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| author_name: github-actions[bot] | |
| author_email: github-actions[bot]@github.com | |
| message: Automatic commit via GitHub Actions | |
| - name: Test | |
| if: ${{ steps.commit.outputs.committed == 'false' }} | |
| run: make test | |
| - name: Run (Linux and MacOS) | |
| if: ${{ runner.os != 'Windows' }} | |
| shell: bash | |
| run: | | |
| cp ./homekeeper ${{ runner.temp }} | |
| cd ${{ runner.temp }} | |
| ./homekeeper init --debug --git https://github.com/retiman/dotfiles.git | |
| - name: Run (Windows) | |
| if: ${{ runner.os == 'Windows' }} | |
| shell: pwsh | |
| run: | | |
| Copy-Item .\homekeeper.exe ${{ runner.temp }} | |
| Set-Location ${{ runner.temp }} | |
| .\homekeeper.exe init --debug --git https://github.com/retiman/dotfiles.git |