Build and Test DevContainer #1
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 Test DevContainer | |
on: | |
push: | |
paths: | |
- '.devcontainer/' | |
pull_request: | |
paths: | |
- '.devcontainer/' | |
workflow_dispatch: | |
jobs: | |
shellcheck-and-test: | |
name: Shellcheck linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PATH | |
run: | | |
echo ::notice title={Setup Permissions}::{Add permissions to .devcontainers/} | |
chmod -R +rwx .devcontainer | |
echo ::notice title={Setup Workspace}::{Add .devcontainers/ to PATH} | |
echo "${{github.workspace}}/.devcontainer" >> "$GITHUB_PATH" | |
echo "${{github.workspace}}/.devcontainer/tests" >> "$GITHUB_PATH" | |
- name: Run ShellCheck | |
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 | |
env: | |
SHELLCHECK_OPTS: -s bash | |
with: | |
format: tty | |
severity: error | |
additional_files: post_start_cli_autocomplete.sh | |
scandir: "${{github.workspace}}/.devcontainer" | |
continue-on-error: true | |
- name: Setup Bats and bats libs | |
id: setup-bats | |
uses: bats-core/bats-action@42fcc8700f773c075a16a90eb11674c0318ad507 | |
- name: Test Devcontainer scripts | |
shell: bash | |
env: | |
BATS_LIB_PATH: ${{ steps.setup-bats.outputs.lib-path }} | |
run: bats .devcontainer/post_start_cli_autocomplete_test.bats | |
build-with-devcontainer-cli: | |
name: Devcontainer CLI Build and Push Cache | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup PATH | |
run: | | |
echo ::notice title={Setup Permissions}::{Add permissions to .devcontainers/} | |
chmod -R +rwx .devcontainer | |
echo ::notice title={Setup Workspace}::{Add .devcontainers/ to PATH} | |
echo "${{github.workspace}}/.devcontainer" >> "$GITHUB_PATH" | |
echo "${{github.workspace}}/.devcontainer/tests" >> "$GITHUB_PATH" | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- run: npm install -g @devcontainers/cli | |
working-directory: ${{ github.workspace }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
buildkitd-flags: true | |
cache-binary: 'true' | |
- name: Test Devcontainer CLI Build | |
run: | | |
echo ::notice title={Building with Devcontainer CLI}::{Building Devcontainer} | |
chmod +x ${{github.workspace}}/.devcontainer/tests/build_devcontainer_ci.sh | |
${{github.workspace}}/.devcontainer/tests/build_devcontainer_ci.sh | |
echo "### Devcontainer CLI Build Successful!!! :rocket:" >> $GITHUB_STEP_SUMMARY | |
env: | |
BUILDKIT_INLINE_CACHE: 1 | |
working-directory: ${{github.workspace}} |