V2 #194
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: Go | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v3 | |
| with: | |
| go-version: 1.26.x | |
| - name: Get coverage tool | |
| run: | | |
| cd application/backend | |
| go get golang.org/x/tools/cmd/cover | |
| REF=${{ github.ref }} | |
| IFS='/' read -ra PATHS <<< "$REF" | |
| BRANCH_NAME="${PATHS[1]}_${PATHS[2]}" | |
| echo $BRANCH_NAME | |
| echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV | |
| - name: Create failing badge | |
| uses: schneegans/dynamic-badges-action@v1.0.0 | |
| with: | |
| auth: ${{ secrets.GIST_SECRET }} | |
| gistID: 7a0933f8cba0bddbcc95c8b850e32663 | |
| filename: onlogs_passing__${{ env.BRANCH }}.json | |
| label: Tests | |
| message: Failed | |
| color: red | |
| namedLogo: checkmarx | |
| - name: Vet | |
| run: | | |
| cd application/backend | |
| go vet ./... | |
| - name: Test | |
| run: | | |
| cd application/backend | |
| go test ./... -coverprofile cover.out | |
| go tool cover -func cover.out > covered.txt | |
| - name: Test with the race detector | |
| run: | | |
| cd application/backend | |
| go test -race ./... | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24.x | |
| - name: Frontend tests | |
| run: | | |
| cd application/frontend | |
| npm ci | |
| npm test | |
| - name: Get coverage | |
| run: | | |
| cd application/backend | |
| for word in $(cat covered.txt); do total_percent=$word; done | |
| echo $total_percent | |
| echo "COVERAGE=$total_percent" >> $GITHUB_ENV | |
| - name: Create passing badge | |
| uses: schneegans/dynamic-badges-action@v1.0.0 | |
| if: ${{ env.COVERAGE!=null }} | |
| with: | |
| auth: ${{ secrets.GIST_SECRET }} | |
| gistID: 7a0933f8cba0bddbcc95c8b850e32663 | |
| filename: onlogs_passing__${{ env.BRANCH }}.json | |
| label: Tests | |
| message: Passed | |
| color: green | |
| namedLogo: checkmarx | |
| - name: Create coverage badge | |
| uses: schneegans/dynamic-badges-action@v1.0.0 | |
| if: ${{ env.COVERAGE!=null }} | |
| with: | |
| auth: ${{ secrets.GIST_SECRET }} | |
| gistID: 7a0933f8cba0bddbcc95c8b850e32663 | |
| filename: onlogs_units_coverage__${{ env.BRANCH }}.json | |
| label: Test Coverage | |
| message: ${{ env.COVERAGE }} | |
| color: green | |
| namedLogo: go | |
| release: | |
| needs: build | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: release | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| steps: | |
| # semantic-release derives the version from tags, so it needs all of them. | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: docker/setup-qemu-action@v3 | |
| - uses: docker/setup-buildx-action@v3 | |
| - uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24.x | |
| # Plugins resolve from the repo, not the npx sandbox, so each is named here. | |
| - name: Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: > | |
| npx -y | |
| -p semantic-release@25.0.9 | |
| -p @semantic-release/commit-analyzer@13.0.1 | |
| -p @semantic-release/release-notes-generator@14.1.1 | |
| -p @semantic-release/exec@7.1.0 | |
| -p @semantic-release/github@12.0.9 | |
| -p conventional-changelog-conventionalcommits@10.2.1 | |
| semantic-release |