Test rails new
docker workflow on a rubies matrix
#3755
Workflow file for this run
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: Build and test --dev image | |
on: [push, pull_request] | |
env: | |
APP_NAME: devrails | |
APP_PATH: dev/devrails | |
jobs: | |
build-and-test-dev-image: | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby-version: ["2.7", "3.0", "3.1", "3.2"] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler: none | |
ruby-version: ${{ matrix.ruby-version }} | |
- uses: actions/cache@v3 | |
with: | |
path: vendor/bundle | |
key: bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }} | |
restore-keys: | | |
bundle-use-ruby-${{ matrix.os }}-${{ matrix.ruby-version }}- | |
- name: Bundle install | |
run: | | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
- name: Generate --dev app | |
run: | | |
bundle exec railties/exe/rails new $APP_PATH --dev | |
- name: Build image | |
run: | | |
podman build -t $APP_NAME \ | |
-v $(pwd):$(pwd) \ | |
-f ./$APP_PATH/Dockerfile \ | |
./$APP_PATH | |
- name: Run container | |
run: | | |
podman run --name $APP_NAME \ | |
-v $(pwd):$(pwd) \ | |
-e SECRET_KEY_BASE_DUMMY=1 \ | |
-p 3000:3000 $APP_NAME & | |
- name: Test container | |
run: ruby -r ./.github/workflows/scripts/test-container.rb | |
notify: | |
runs-on: ubuntu-latest | |
if: always() && github.ref_name == 'main' | |
continue-on-error: true | |
needs: build-and-test-dev-image | |
steps: | |
- uses: zzak/action-discord@v4 | |
with: | |
webhook: ${{ secrets.DISCORD_WEBHOOK }} |