From e3e028102a93f7377673a5aa84be4fc9991f5ae9 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 | 33 ++++++++++++++++++++++++ 3 files changed, 53 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..076e3a2 --- /dev/null +++ b/.github/workflows/test-ruby-feature.yaml @@ -0,0 +1,33 @@ +name: Test ruby feature + +on: + push: + pull_request: + +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 devcontainer with feature + 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 )