diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 151179d524f..458e6eb85e6 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -41,36 +41,19 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + - name: Get Repo Token + id: REPO_TOKEN + uses: tibdex/github-app-token@v1 with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a - # config file. - # By default, queries listed here will override any specified in a - # config file. - # Prefix the list here with "+" to use these queries and those in the - # config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually - # (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - # ℹī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following - # three lines and modify them (or add more) to build your code if your - # project uses a compiled language - - # - run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + app_id: ${{ secrets.DEVOGE_BOT_PUB_APPID }} + private_key: ${{ secrets.DEVOGE_BOT_PUB_PEM }} + - name: Get composite run steps repository + uses: actions/checkout@v3 + with: + repository: mosaicml/testing + ref: cicd + path: ./testing + token: ${{ steps.REPO_TOKEN.outputs.token }} + - uses: ./testing/.github/actions/codeql-analysis + with: + language: ${{ matrix.language }} diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index f89d67ec39f..9a71e0fc5e1 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -12,21 +12,19 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v3 - - name: Setup - run: | - set -ex - python -m pip install --upgrade 'pip<23' wheel - pip install coverage[toml]==6.5.0 - - name: Download artifacts - uses: actions/download-artifact@v3 + - name: Get Repo Token + id: REPO_TOKEN + uses: tibdex/github-app-token@v1 with: - path: ${{ inputs.download-path }} - - name: Generate coverage report - run: | - set -ex - - # Flatten the coverage files - ls ${{ inputs.download-path }} | while read x; do mv ${{ inputs.download-path }}/$x/.coverage .coverage.$x; done - - python -m coverage combine - python -m coverage report + app_id: ${{ secrets.DEVOGE_BOT_PUB_APPID }} + private_key: ${{ secrets.DEVOGE_BOT_PUB_PEM }} + - name: Get composite run steps repository + uses: actions/checkout@v3 + with: + repository: mosaicml/testing + ref: cicd + path: ./testing + token: ${{ steps.REPO_TOKEN.outputs.token }} + - uses: ./testing/.github/actions/coverage + with: + download-path: ${{ inputs.download-path }} diff --git a/.github/workflows/docker-configure-build-push.yaml b/.github/workflows/docker-configure-build-push.yaml index 2b6bf4893dd..8267bbfdb47 100644 --- a/.github/workflows/docker-configure-build-push.yaml +++ b/.github/workflows/docker-configure-build-push.yaml @@ -34,62 +34,47 @@ on: required: true password: required: true + app_id: + required: true + private_key: + required: true jobs: configure-build-push: runs-on: ubuntu-latest steps: - - name: Maximize Build Space on Worker - uses: easimon/maximize-build-space@v4 - with: - overprovision-lvm: true - remove-dotnet: true - remove-android: true - remove-haskell: true - - name: Checkout uses: actions/checkout@v3 - - - name: Setup QEMU - uses: docker/setup-qemu-action@v2 - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 + - name: Get Repo Token + id: REPO_TOKEN + uses: tibdex/github-app-token@v1 with: - username: ${{ secrets.username }} - password: ${{ secrets.password }} - - - name: Calculate Docker Image Variables + app_id: ${{ secrets.app_id }} + private_key: ${{ secrets.private_key }} + - name: Get composite run steps repository + uses: actions/checkout@v3 + with: + repository: mosaicml/testing + ref: cicd + path: ./testing + token: ${{ steps.REPO_TOKEN.outputs.token }} + - name: List files run: | - set -euo pipefail - - ################### - # Calculate the tag - ################### - if [ "${{ inputs.staging }}" = "true" ]; then - STAGING_REPO=${{ inputs.staging-repo }} - IMAGE_TAG=${STAGING_REPO}:${{ inputs.image-uuid }} - IMAGE_CACHE="${STAGING_REPO}:${{ inputs.image-name }}-buildcache" - else - IMAGE_TAG=${{ inputs.tags }} - IMAGE_CACHE="${IMAGE_TAG/,*/}-buildcache" - fi - - echo "IMAGE_TAG=${IMAGE_TAG}" >> ${GITHUB_ENV} - echo "IMAGE_CACHE=${IMAGE_CACHE}" >> ${GITHUB_ENV} - - - name: IMAGE_TAG = ${{ env.IMAGE_TAG }} - run: echo ${{ env.IMAGE_TAG }} - - - name: Build and Push the Docker Image - uses: docker/build-push-action@v3 + pwd + ls -d $PWD/* + ls -d $PWD/*/testing + ls -d $PWD/*/testing/.github + ls -d $PWD/*/testing/.github/actions + ls -d $PWD/*/testing/.github/actions/docker-configure-build-push + - uses: ./testing/.github/actions/docker-configure-build-push with: + build-args: ${{ inputs.build-args }} context: ${{ inputs.context }} - tags: ${{ env.IMAGE_TAG }} - target: ${{ inputs.target }} + image-name: ${{ inputs.image-name }} + image-uuid: ${{ inputs.image-uuid }} push: ${{ inputs.push }} - cache-from: type=registry,ref=${{ env.IMAGE_CACHE }} - cache-to: type=registry,ref=${{ env.IMAGE_CACHE }},mode=max - build-args: ${{ inputs.build-args }} + staging: ${{ inputs.staging }} + staging-repo: ${{ inputs.staging-repo }} + tags: ${{ inputs.tags }} + target: ${{ inputs.target }} + username: ${{ secrets.username }} + password: ${{ secrets.password }} diff --git a/.github/workflows/pr-code-quality.yaml b/.github/workflows/pr-code-quality.yaml index 26d2546e75c..01fae1fbb0d 100644 --- a/.github/workflows/pr-code-quality.yaml +++ b/.github/workflows/pr-code-quality.yaml @@ -14,7 +14,8 @@ concurrency: cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/dev' }} jobs: code-quality: - uses: ./.github/workflows/code-quality.yaml + runs-on: ubuntu-20.04 + timeout-minutes: 15 strategy: matrix: python_version: @@ -23,6 +24,23 @@ jobs: - "3.11" pip_deps: - "[dev]" - with: - python_version: ${{ matrix.python_version }} - pip_deps: ${{ matrix.pip_deps }} + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Get Repo Token + id: REPO_TOKEN + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.DEVOGE_BOT_PUB_APPID }} + private_key: ${{ secrets.DEVOGE_BOT_PUB_PEM }} + - name: Get composite run steps repository + uses: actions/checkout@v3 + with: + repository: mosaicml/testing + ref: cicd + path: ./testing + token: ${{ steps.REPO_TOKEN.outputs.token }} + - uses: ./testing/.github/actions/code-quality + with: + python_version: ${{ matrix.python_version }} + pip_deps: ${{ matrix.pip_deps }} diff --git a/.github/workflows/pr-docker.yaml b/.github/workflows/pr-docker.yaml index 93f0b51be13..9556bc31bd4 100644 --- a/.github/workflows/pr-docker.yaml +++ b/.github/workflows/pr-docker.yaml @@ -70,3 +70,5 @@ jobs: secrets: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} + app_id: ${{ secrets.DEVOGE_BOT_PUB_APPID }} + private_key: ${{ secrets.DEVOGE_BOT_PUB_PEM }} diff --git a/.github/workflows/release-docker.yaml b/.github/workflows/release-docker.yaml index e992663994f..a08ca129cd7 100644 --- a/.github/workflows/release-docker.yaml +++ b/.github/workflows/release-docker.yaml @@ -64,3 +64,5 @@ jobs: secrets: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} + app_id: ${{ secrets.DEVOGE_BOT_PUB_APPID }} + private_key: ${{ secrets.DEVOGE_BOT_PUB_PEM }} diff --git a/.spr.yml b/.spr.yml new file mode 100644 index 00000000000..e2c99fd91f3 --- /dev/null +++ b/.spr.yml @@ -0,0 +1,9 @@ +githubRepoOwner: mosaicml +githubRepoName: composer +githubRemote: upstream +githubBranch: dev +mergeMethod: squash +prTemplatePath: .github/PULL_REQUEST_TEMPLATE.md +prTemplateInsertStart: "# What does this PR do?" +prTemplateInsertEnd: "# What issue(s) does this change relate to?" +