From 20a3376bc99012f49839505f5c9629bb7a1bc20e Mon Sep 17 00:00:00 2001 From: Geoff Wilson Date: Fri, 23 Aug 2024 13:50:35 -0400 Subject: [PATCH] added container persistence for dev container; plus readme tweaks --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ README.md | 14 +++++++++----- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fcf3b18..0d45dc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,24 @@ on: branches: [ main ] jobs: + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and run Dev Container task + uses: devcontainers/ci@v0.3 + with: + # Change this to point to your image name + imageName: ghcr.io/gresearch/astral-devcontainer + # Change this to be your CI task/script + runCmd: | + # Add multiple commands to run if needed + bundle install + scan_ruby: runs-on: ubuntu-latest @@ -16,6 +34,7 @@ jobs: - name: Run brakeman uses: devcontainers/ci@v0.3 with: + imageName: ghcr.io/gresearch/astral-devcontainer runCmd: bin/brakeman --no-pager lint: @@ -49,6 +68,7 @@ jobs: - name: Run tests uses: devcontainers/ci@v0.3 with: + imageName: ghcr.io/gresearch/astral-devcontainer runCmd: bin/rails test - name: Keep screenshots from failed system tests diff --git a/README.md b/README.md index a28d48c..85318bf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # README -Astral-rails is a proof-of-concept api application intended to simplify +Astral is an api-only application intended to simplify certificate acquisition for other applications/services. Broadly speaking, it will: @@ -10,16 +10,20 @@ it will: # Running -This app is most easily run and developed in its devcontainer. +This Rails app is most easily run and developed in its devcontainer. 1) Open in devcontainer 2) Launch server using vscode launch config, or in terminal run: ``` rails s ``` -3) POST /certificates to acquire cert in terminal: +3) POST /certificates to acquire cert in another terminal (need to provide `common_name` param): ``` curl -X POST http://localhost:3000/certificates \ --H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBsaWNhdGlvbl9uYW1lIiwiY29tbW9uX25hbWUiOiJleGFtcGxlLmNvbSIsImlwX3NhbnMiOiIxMC4wLjEuMTAwIn0.61e0oQIj7vwGtOpFuPJDCI_Bqf8ZTpJxe_2kUwcbN7Y" +-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhcHBsaWNhdGlvbl9uYW1lIiwiY29tbW9uX25hbWUiOiJleGFtcGxlLmNvbSIsImlwX3NhbnMiOiIxMC4wLjEuMTAwIn0.61e0oQIj7vwGtOpFuPJDCI_Bqf8ZTpJxe_2kUwcbN7Y" \ +-H "Content-type: application/json" -d '{ "common_name": "example.com" }' +``` +4) Run the tests from devcontainer terminal: +``` +rails test ``` -