Travis to Github Action Migration #286
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: CI & Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # needed to push coverage to gh-pages | |
| pull-requests: write # needed to comment on PRs | |
| strategy: | |
| matrix: | |
| go-version: ["1.24.5"] | |
| fail-fast: false | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| check-latest: true | |
| cache: true | |
| - name: Install system dependencies (bc + docker) | |
| run: | | |
| sudo apt-get update -qq | |
| sudo apt-get install -y bc docker-ce-cli | |
| - name: Make scripts executable | |
| run: chmod +x scripts/*.sh || true | |
| - name: Prepare environment | |
| run: | | |
| export GO111MODULE=on | |
| go mod tidy | |
| make deps | |
| - name: Check code formatting | |
| run: make fmt | |
| - name: Run unit tests | |
| run: make test | |
| - name: Generate coverage | |
| run: | | |
| make coverage | |
| ./scripts/calculateCoverage.sh | |
| touch "Passing" || touch "Failed" | |
| - name: Build driver image | |
| run: make driver | |
| - name: Publish coverage | |
| if: success() | |
| env: | |
| GHE_TOKEN: ${{ secrets.GHE_TOKEN }} | |
| run: | | |
| ./scripts/publishCoverage.sh | |
| release: | |
| needs: build-and-test | |
| permissions: write-all | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| package_dir: | |
| - cos-csi-mounter | |
| env: | |
| IS_LATEST_RELEASE: 'true' | |
| APP_VERSION: 1.0.5 | |
| # Add the condition to trigger release based on commit message containing "release" | |
| if: contains(github.event.head_commit.message, 'release') | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v5 | |
| - name: Print Go Version | |
| run: go version | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v3 | |
| with: | |
| languages: "go" | |
| - name: Run Unit Tests for cos csi mounter | |
| run: sudo make ut-coverage -C ${{ matrix.package_dir }} | |
| - name: Build Debian and RPM packages for cos-csi-mounter systemd service | |
| run: | | |
| cd ${{ matrix.package_dir }} | |
| make packages | |
| - name: Get last commit message | |
| id: check_commit | |
| run: | | |
| message=$(git log -1 --pretty=%B) | |
| message="${message//'%'/'%25'}" # Escape '%' | |
| message="${message//$'\n'/'%0A'}" # Escape newlines | |
| message="${message//$'\r'/'%0D'}" # Escape carriage returns | |
| echo "message=$message" >> "$GITHUB_OUTPUT" | |
| shell: bash | |
| - name: Check Commit Message | |
| run: | | |
| echo "Commit Message: ${{ steps.check_commit.outputs.message }}" | |
| - name: Latest Version (Tag and Release) | |
| id: release | |
| if: contains(steps.check_commit.outputs.message, 'publish') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: | | |
| /home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.deb.tar.gz | |
| /home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.deb.tar.gz.sha256 | |
| /home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.rpm.tar.gz | |
| /home/runner/work/ibm-object-csi-driver/ibm-object-csi-driver/cos-csi-mounter/cos-csi-mounter-${{ env.APP_VERSION }}.rpm.tar.gz.sha256 | |
| tag_name: v1.0.5 | |
| name: v1.0.5 | |
| body: | | |
| ## 🚀 What’s New | |
| - Fix for rclone mount hang issue | |
| prerelease: ${{ env.IS_LATEST_RELEASE != 'true' }} | |
| - name: Perform CodeQL Analysis | |
| uses: github/codeql-action/analyze@v3 |