Merge pull request #154 from elisasre/dependabot/go_modules/golang.or… #125
This file contains 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: Main | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
test-go: | |
runs-on: elisa-normal | |
timeout-minutes: 15 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup Go and Mage | |
uses: elisa-actions/setup-go-and-mage@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Google Artifact Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: europe-north1-docker.pkg.dev | |
username: _json_key | |
password: ${{ secrets.GAR_JSON_KEY }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
- name: Verify dependencies | |
run: | | |
go mod tidy | |
git diff --exit-code -- go.mod go.sum || (echo "Deps are not up to date: run 'go mod tidy' before commit" && exit 1) | |
- run: mage go:lint | |
working-directory: ./godemo | |
- run: mage go:tidy | |
working-directory: ./godemo | |
- run: mage go:tidyAndVerify | |
working-directory: ./godemo | |
- run: mage go:licenses | |
working-directory: ./godemo | |
- run: mage go:unitTest | |
working-directory: ./godemo | |
- run: mage go:integrationTest | |
working-directory: ./godemo | |
- run: mage go:coverProfile | |
working-directory: ./godemo | |
- run: mage go:build | |
working-directory: ./godemo | |
- run: mage go:crossBuild | |
working-directory: ./godemo | |
- run: mage lambda:buildAll | |
working-directory: ./godemo | |
- run: mage docker:build | |
working-directory: ./godemo | |
- run: mage docker:push | |
working-directory: ./godemo | |
env: | |
DOCKER_IMAGE_TAGS: sha-${{ github.sha }} | |
- run: mage docs:openAPI | |
working-directory: ./godemo | |
- run: | | |
if ($(mage yaml:lint)) ; then | |
echo "mage yaml:lint should have failed!" | |
exit 1 | |
fi | |
working-directory: ./godemo | |
- run: mage yaml:fmt | |
working-directory: ./godemo | |
- run: mage yaml:lint | |
working-directory: ./godemo | |
- run: mage npm:test | |
working-directory: ./godemo | |
- run: mage npm:cleanBuild | |
working-directory: ./godemo | |
- run: mage npm:lint | |
working-directory: ./godemo | |
- run: test -x godemo/target/bin/linux/amd64/godemo | |
- run: test -f godemo/target/bin/linux/amd64/godemo.sha256 | |
- run: test -x godemo/target/bin/darwin/amd64/godemo | |
- run: test -f godemo/target/bin/linux/amd64/godemo.sha256 | |
- run: test -x godemo/target/bin/darwin/arm64/godemo | |
- run: test -f godemo/target/bin/linux/amd64/godemo.sha256 | |
- run: test -x godemo/target/bin/windows/amd64/godemo | |
- run: test -f godemo/target/bin/windows/amd64/godemo.sha256 | |
- run: test -f godemo/target/testbin/godemo | |
- run: test -f godemo/target/bin/linux/amd64/lambda/godemo/bootstrap | |
- run: test -d godemo/target/tests/cover/unit/ | |
- run: test -d godemo/target/tests/cover/int/ | |
- run: test -f godemo/target/tests/cover/combined/cover.txt | |
- name: Validate merge coverage | |
working-directory: ./godemo | |
run: go tool cover -func target/tests/cover/combined/cover.txt | grep LoadSpec | grep '100.0%' | |
- run: docker images | grep 'europe-north1-docker.pkg.dev/sose-sre-5737/sre-public/godemo' | |
- name: Notify failure | |
if: failure() | |
env: | |
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }} | |
MATTERMOST_TEXT: "${{ github.repository }} PR build. Please check [here](${{ github.event.pull_request.html_url }}/checks)." | |
run: | | |
send-to-mattermost | |
release-drafter: | |
runs-on: elisa-normal | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- uses: elisa-actions/release-drafter@v6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
disable-releaser: false | |
disable-autolabeler: true | |
- name: Notify failure | |
if: failure() | |
env: | |
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }} | |
MATTERMOST_TEXT: "${{ github.repository }} [${{ github.event.ref }}](${{ github.event.repository.html_url }}/tree/${{ github.event.ref }}) release failed." | |
run: | | |
send-to-mattermost |