diff --git a/.github/workflows/build-devcontainer.yaml b/.github/workflows/build-devcontainer.yaml new file mode 100644 index 00000000..800a7d5e --- /dev/null +++ b/.github/workflows/build-devcontainer.yaml @@ -0,0 +1,132 @@ +on: + workflow_call: + inputs: + push: + type: string + default: true + description: "Whether to push the image." + repo: + type: string + required: true + description: "Devcontainer image repository." + tag: + type: string + required: true + description: "Devcontainer image tag." + workspace-dir: + type: string + default: '.' + description: "Devcontainer workspace directory." + devcontainer-json: + type: string + required: true + description: "Path to the devcontainer.json file." + timeout-minutes: + type: number + default: 360 + description: "Maximum time (in minutes) allowed for a run of this workflow." + retries: + type: string + default: '3' + description: "Number of times to retry the image build" + runs-on: + type: string + default: "ubuntu-latest" + description: "GHA runner label." + outputs: + version: + value: ${{ jobs.build.outputs.version }} + + +permissions: + actions: none + checks: none + contents: none + deployments: none + discussions: none + issues: none + packages: write + pages: none + pull-requests: none + repository-projects: none + security-events: none + statuses: none + +jobs: + build: + timeout-minutes: ${{ inputs.timeout-minutes }} + strategy: + fail-fast: false + matrix: + arch: [amd64, arm64] + runs-on: ${{ fromJSON(github.actor != 'rapidsai' && '"ubuntu-latest"' || format('"${{ inputs.runs-on }}"', matrix.arch)) }} + name: "${{ inputs.tag }} (${{ matrix.arch }})" + outputs: + hash_amd64: ${{ steps.build.outputs.hash_amd64 }} + hash_arm64: ${{ steps.build.outputs.hash_arm64 }} + name: ${{ steps.build.outputs.name }} + repo: ${{ steps.build.outputs.repo }} + tag: ${{ steps.build.outputs.tag }} + version: ${{ steps.setup.outputs.version }} + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + persist-credentials: false + + - id: setup + name: Setup versions + run: | + cat <> "$GITHUB_OUTPUT" + digests=${DIGESTS[*]} + name=${NAME} + tags=${TAGS[*]} + EOF + + - name: Clean up untagged images + uses: snok/container-retention-policy@3b0972b2276b171b212f8c4efbca59ebba26eceb + with: + cut-off: 1hr + tag-selection: untagged + token: "${{ github.token }}" + image-tags: "${{ steps.vars.outputs.tags }}" + image-names: "${{ steps.vars.outputs.name }}" + skip-shas: "${{ steps.vars.outputs.digests }}" + account: "${{ github.actor == github.triggering_actor && 'user' || github.actor }}"