Go #8
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: Go | |
on: | |
workflow_dispatch: null | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
# Run full test once a day | |
- cron: "0 0 * * *" | |
permissions: {} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
# https://github.com/actions/setup-go | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
cache: false | |
go-version: 1.21.5 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
# Required: the version of golangci-lint is required | |
# and must be specified without patch version: | |
# we always use the latest patch version. | |
version: v1.55.2 | |
install-mode: "binary" | |
- name: Install GoReleaser | |
uses: goreleaser/goreleaser-action@v5 | |
with: | |
install-only: true | |
- name: Show GoReleaser version | |
run: goreleaser --version | |
- name: Build | |
run: make build | |
- name: Quick Test | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: make test-short | |
if: ${{ github.event_name == 'pull_request' }} | |
- name: All Test | |
env: | |
# Access only to ec2 AMI api in read-only | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} | |
UPDATECLI_GITEA_TOKEN: ${{ secrets.UPDATECLI_GITEA_TOKEN }} | |
run: make test | |
if: ${{ github.event_name == 'schedule' }} | |
# Codecov should only be updated if make test is executed | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
if: ${{ github.event_name == 'schedule' }} | |
# Manage and run your integration tests with efficiency | |
# https://github.com/ovh/venom | |
- name: Install Venom | |
run: | | |
curl -o /usr/local/bin/venom https://github.com/ovh/venom/releases/download/$VENOM_VERSION/venom.linux-amd64 -L | |
sudo chmod +x /usr/local/bin/venom | |
ls -lha /usr/local/bin/venom | |
env: | |
VENOM_VERSION: v1.1.0 | |
- name: Show Venom version | |
run: venom version | |
- name: Run End to End tests | |
run: make test-e2e | |
env: | |
IS_TTY: true # https://github.com/ovh/venom#use-venom-in-ci | |
# Access only to ec2 AMI api in read-only | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |