Verify devcontainers #11
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: Verify devcontainers | |
on: | |
push: | |
branches: | |
- "pull-request/[0-9]+" | |
paths: | |
- '.devcontainer/**' | |
- 'ci/matrix.yaml' | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash -euo pipefail {0} | |
concurrency: | |
group: ${{ github.workflow }}-on-${{ github.event_name }}-from-${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
get-devcontainer-list: | |
runs-on: ubuntu-latest | |
outputs: | |
devcontainer_list: ${{ steps.get-list.outputs.devcontainer_list }} | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
- name: Get list of devcontainer.json paths | |
id: get-list | |
run: | | |
devcontainer_list=$(find .devcontainer/ -name 'devcontainer.json' | jq -R -s -c 'split("\n")[:-1]') | |
echo "devcontainer_list=$devcontainer_list" | tee --append "${GITHUB_OUTPUT}" | |
verify-devcontainers: | |
needs: get-devcontainer-list | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
devcontainer: ${{fromJson(needs.get-devcontainer-list.outputs.devcontainer_list)}} | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v3 | |
# devcontainer/ci doesn't supported nested devcontainer.json files, so we need to copy the devcontainer.json | |
# file to the top level .devcontainer/ directory | |
- name: Copy devcontainer.json to .devcontainer/ | |
run: cp ${{ matrix.devcontainer }} .devcontainer/devcontainer.json | |
# We don't really need sccache configured, but we need the AWS credentials envvars to be set | |
# in order to avoid the devcontainer hanging waiting for GitHub authentication | |
- name: Configure credentials and environment variables for sccache | |
uses: ./.github/actions/configure_cccl_sccache | |
- name: Run in devcontainer | |
uses: devcontainers/ci@v0.3 | |
with: | |
push: never | |
env: | | |
SCCACHE_REGION=${{ env.SCCACHE_REGION }} | |
AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }} | |
AWS_SESSION_TOKEN=${{ env.AWS_SESSION_TOKEN }} | |
AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} | |
runCmd: | | |
set -euo pipefail | |
echo "Hello world" | |
#- name: Start dev container | |
# run: devcontainer up --config .devcontainer/standalone/devcontainer.json --workspace-folder . | |
#- name: Run tests in dev container | |
# run: devcontainer exec --config .devcontainer/standalone/devcontainer.json --workspace-folder . make test | |
#- name: Verify devcontainer.json files | |
# run: | | |
# # Navigate to the directory containing devcontainer configurations | |
# cd .devcontainer | |
# # For each devcontainer, try to create and run it using devcontainer-cli | |
# for dir in $(ls -d */); do | |
# cd $dir | |
# devcontainer-cli up | |
# # Assuming the container has NVIDIA utilities to verify CUDA version | |
# CONTAINER_ID=$(docker ps -aqf "name=devcontainer_$(basename $dir)") | |
# CONTAINER_CUDA_VERSION=$(docker exec $CONTAINER_ID nvcc --version | grep release | awk '{print $6}' | cut -c2-) | |
# if [ -z "$CONTAINER_CUDA_VERSION" ]; then | |
# echo "::error:: Failed to determine CUDA version for $dir" | |
# exit 1 | |
# fi | |
# echo "Verified $dir with CUDA version: $CONTAINER_CUDA_VERSION" | |
# # Tear down the container | |
# devcontainer-cli down | |
# cd .. | |
# done |