test: add tests for Gitea scanner, GitLab pure functions, mergeNewAliases #844
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
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| name: ci | |
| permissions: {} | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| # The build job will use the .git directory to | |
| # infer the current version to embed in the binary | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 | |
| with: | |
| go-version: '1.25' | |
| - run: go build | |
| - run: go test -race ./... | |
| - uses: golang/govulncheck-action@b625fbe08f3bccbe446d94fbf87fcc875a4f50ee # v1.0.4 | |
| with: | |
| repo-checkout: false | |
| build_and_publish_docker_image: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| if: ${{ github.event_name != 'pull_request' }} | |
| steps: | |
| - name: Login to DockerHub | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Get Docker image tags | |
| id: image_tags | |
| run: | | |
| IMAGE=italia/publiccode-crawler | |
| TAGS=${IMAGE}:latest | |
| TAGS="$TAGS,${IMAGE}:${GITHUB_SHA::8}" | |
| echo "tags=${TAGS}" >> "$GITHUB_OUTPUT" | |
| - name: Build and push | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7 | |
| with: | |
| build-args: | | |
| BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 | |
| push: true | |
| tags: ${{ steps.image_tags.outputs.tags }} |