diff --git a/.github/workflows/bundler_audit.yml b/.github/workflows/bundler_audit.yml index 94502c9..5452e63 100644 --- a/.github/workflows/bundler_audit.yml +++ b/.github/workflows/bundler_audit.yml @@ -6,20 +6,20 @@ on: jobs: run-bundler_audit: name: Run bundler audit - runs-on: ubuntu-latest - strategy: - matrix: - ruby-version: ["3.0"] + runs-on: [self-hosted, utils] + steps: - - uses: actions/checkout@v2 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 with: - ruby-version: ${{ matrix.ruby-version }} - - name: Install bundle audit - run: gem install bundle-audit - - name: Update Ruby Advisory Database - run: bundle-audit update - - name: Run audit - run: bundle audit + registries: 158094083467 + + - name: Run tests + shell: bash + run: | + docker run --rm -v $(pwd):/usr/src/app 158094083467.dkr.ecr.eu-west-1.amazonaws.com/bundler-audit bundle audit --update \ No newline at end of file diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 6a7181f..bd922d8 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -11,19 +11,44 @@ env: jobs: run-tests: name: Run RSpec - runs-on: ubuntu-latest - strategy: - matrix: - ruby-version: ["3.0"] + runs-on: [self-hosted, utils] + steps: - - uses: actions/checkout@v2 - - name: Set up Ruby - # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby - uses: ruby/setup-ruby@v1 + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + with: + registries: 158094083467 + + - name: Set up Docker Context for Buildx + id: buildx-context + shell: bash + run: | + docker context create builders + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 with: - ruby-version: ${{ matrix.ruby-version }} - # runs 'bundle install' and caches installed gems automatically - bundler-cache: true + version: latest + endpoint: builders + + - name: Build tests image + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile-test + tags: ${{ env.APPLICATION_NAME }}:rspec-tests-${{ github.sha }} + push: false + load: true + cache-from: type=gha + cache-to: type=gha,mode=max + - name: Run tests - run: bundle exec rspec + shell: bash + run: | + docker run --rm \ + -e "RAILS_ENV=test" \ + -t ${{ env.APPLICATION_NAME }}:rspec-tests-${{ github.sha }} "bundle exec rspec" \ No newline at end of file diff --git a/Dockerfile-test b/Dockerfile-test new file mode 100644 index 0000000..92d8765 --- /dev/null +++ b/Dockerfile-test @@ -0,0 +1 @@ +FROM 158094083467.dkr.ecr.eu-west-1.amazonaws.com/ruby:2.7.4-onbuild-dev