Support gnoland testnet6 #17
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: CVMS CI | |
| # When this workflow is triggered | |
| on: | |
| push: # On every push to any branch | |
| branches: | |
| - develop # Or your fork's default branch name, e.g., develop, master | |
| - release | |
| tags: | |
| - "v*.*.*" # For release tagging later | |
| pull_request: # On every pull request targeting the main branch | |
| branches: | |
| - develop | |
| jobs: | |
| build-and-test: | |
| name: Build and Test | |
| runs-on: ubuntu-latest # Use the latest Ubuntu runner provided by GitHub | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "1.23" # Specify your Go version. Check your go.mod for this. | |
| cache: true # Enable caching of Go modules to speed up subsequent runs | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v8 | |
| with: | |
| version: v2.1.5 | |
| args: --timeout=5m | |
| # TODO: Ignore this step for now | |
| # Step 4: Run Go Tests | |
| # - name: Run Go Tests | |
| # run: go test -v ./... | |
| - name: Build Go Application (Verification) | |
| run: go build -v ./... # 코드 컴파일 가능성 검증 | |
| build-and-push-docker-image: | |
| name: Build and Push Docker Image | |
| runs-on: ubuntu-latest | |
| needs: build-and-test # Ensures this job runs only if build-and-test succeeds | |
| # This job will only run for pushes (not PRs) to 'develop', 'release', or tags. | |
| if: | | |
| github.event_name == 'push' && | |
| ( | |
| github.ref == 'refs/heads/develop' || | |
| github.ref == 'refs/heads/release' || | |
| startsWith(github.ref, 'refs/tags/v') | |
| ) | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # If you use git tags for versioning in Docker tags, fetch all history/tags | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ghcr.io/${{ github.repository_owner }}/cvms | |
| tags: | | |
| # For pushes to the 'develop' branch, tag the image as 'develop'. | |
| # Enabled only when the push is to 'refs/heads/develop'. | |
| type=raw,value=develop,enable=${{ github.ref == 'refs/heads/develop' }} | |
| # For pushes to the 'release' branch, tag the image as 'release'. | |
| # This can be used for release candidates or pre-releases. | |
| # Enabled only when the push is to 'refs/heads/release'. | |
| type=raw,value=release,enable=${{ github.ref == 'refs/heads/release' }} | |
| # For Git tags (e.g., v1.2.3): | |
| # Create a Docker tag that exactly matches the Git tag (e.g., v1.2.3). | |
| type=semver,pattern={{version}} | |
| # Create a Docker tag for the major and minor version (e.g., 1.2 from v1.2.3). | |
| type=semver,pattern={{major}}.{{minor}} | |
| # Create a Docker tag for the major version only (e.g., 1 from v1.2.3). | |
| type=semver,pattern={{major}} | |
| # Tag images built from any Git tag starting with 'v' also as 'latest'. | |
| # Note: This means if you push e.g. v2.0.0-beta, it would also be tagged 'latest'. | |
| # For a more sophisticated 'latest' tag pointing only to stable releases, | |
| # consider using flavor options or more specific rules. | |
| type=raw,value=latest,enable=${{startsWith(github.ref, 'refs/tags/v')}} | |
| # For every push, create a Docker tag with the short commit SHA. | |
| # This provides a unique, immutable tag for each build. | |
| # Example: a1b2c3d | |
| type=sha,prefix=,suffix=,format=short | |
| - name: Set up QEMU (for multi-platform builds, optional) | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry (GHCR) | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/amd64,linux/arm64 # Uncomment for multi-platform builds | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |