[Testing] Implementation of an updated testing framework #97
Workflow file for this run
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: Build Docker Container | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- main | |
- 'release/[0-9]+.[0-9]+' | |
push: | |
branches: | |
- 'main' | |
release: | |
types: [created, published] | |
schedule: | |
- cron: '0 2 * * *' | |
# TODO: docker containers created through a release cut vs PR to the release branch | |
# will be pushed to different locations (i.e one will be sparseml the other will be test-sparseml). | |
# These containers rely on the new internal pypi server being enabled. Once enabled, | |
# this workflow can be expanded to make this distinction. | |
env: | |
RELEASE: ${{ github.event_name =='release' || (startsWith(github.base_ref, 'release/') && github.event_name == 'pull_request')}} | |
DEV: ${{ github.base_ref == 'main' && github.event_name == 'pull_request'}} | |
NAME: ${{ github.event.number }} | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
build-container: | |
name: Build sparseml container | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
buildkitd-flags: --debug | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y%m%d')" | |
- name: Get the current version | |
if: ${{ env.RELEASE == 'true' }} | |
id: version | |
run: echo "::set-output name=version::$(echo ${{ github.base_ref }} | cut -c 9-15)" | |
- name: Login to Github Packages | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Dev Docker Container | |
if: ${{ env.DEV == 'true' }} | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./docker/containers/docker_dev | |
build-args: | | |
BRANCH=${{github.head_ref}} | |
push: true | |
tags: ghcr.io/neuralmagic/sparseml-dev:${{ env.NAME }} | |
- name: Build Release Docker Container | |
if: ${{ env.RELEASE == 'true' }} | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./docker/containers/docker_release | |
build-args: | | |
VERSION=${{ steps.version.outputs.version }} | |
push: true | |
tags: ghcr.io/neuralmagic/test-sparseml:latest, ghcr.io/neuralmagic/test-sparseml:${{ steps.version.outputs.version }} | |
- name: Build Nightly Docker Container | |
if: ${{ env.DEV == 'false' && env.RELEASE == 'false'}} | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./docker/containers/docker_nightly | |
push: true | |
tags: ghcr.io/neuralmagic/test-sparseml-nightly:latest, ghcr.io/neuralmagic/test-sparseml-nightly:${{ steps.date.outputs.date }} |