From c2d0cbb0d4cdc1a8e4de0d1650c63b434c9d7a72 Mon Sep 17 00:00:00 2001 From: Andrew Novoselac Date: Tue, 9 Apr 2024 11:19:50 -0400 Subject: [PATCH] Create workflow for testing for the ruby feature This workflow spins up a devcontainer that uses the ruby feature and checks that ruby is installed. --- .github/.devcontainer/devcontainer.json | 19 ++++++++++++++ .github/.devcontainer/features | 1 + .github/workflows/test-ruby-feature.yaml | 32 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 .github/.devcontainer/devcontainer.json create mode 120000 .github/.devcontainer/features create mode 100644 .github/workflows/test-ruby-feature.yaml diff --git a/.github/.devcontainer/devcontainer.json b/.github/.devcontainer/devcontainer.json new file mode 100644 index 0000000..639f342 --- /dev/null +++ b/.github/.devcontainer/devcontainer.json @@ -0,0 +1,19 @@ +{ + "image": "mcr.microsoft.com/devcontainers/base:1-bookworm", + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "true", + "username": "vscode", + "userUid": "1000", + "userGid": "1000", + "upgradePackages": "true" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": "false" + }, + "./features/ruby": {} + }, + // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} diff --git a/.github/.devcontainer/features b/.github/.devcontainer/features new file mode 120000 index 0000000..c9012f2 --- /dev/null +++ b/.github/.devcontainer/features @@ -0,0 +1 @@ +../../features \ No newline at end of file diff --git a/.github/workflows/test-ruby-feature.yaml b/.github/workflows/test-ruby-feature.yaml new file mode 100644 index 0000000..201c7a4 --- /dev/null +++ b/.github/workflows/test-ruby-feature.yaml @@ -0,0 +1,32 @@ +name: Test ruby feature + +on: + push: + +jobs: + build: + name: Test ruby feature + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout (GitHub) + uses: actions/checkout@v3 + + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and test devcontainer + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/rails/devcontainer/test-ruby-feature + cacheFrom: ghcr.io/rails/devcontainer/test-ruby-feature + subFolder: .github + refFilterForPush: refs/heads/main + runCmd: ruby -v || ( echo "Ruby is not installed."; exit 1 )