Add workflow to build a ctsm container for unit testing #27
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: Build and Push CIME Container | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/cime-build.yml' | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| buildkitd-flags: --debug | |
| - name: Lowercase the github.repository name | |
| # This step addresses https://github.com/orgs/community/discussions/25768 | |
| run: | | |
| echo "REPO_NAME=`echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'`" >> $GITHUB_ENV | |
| - name: Build and push image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./unit-testing/ | |
| dockerfile: Dockerfile-CIME | |
| push: true | |
| tags: ghcr.io/${{ env.REPO_NAME}}/unit-testing:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |