From 048ea42fff28ac02626a7e4d4e74f1b77ed60d2a Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Fri, 26 Jan 2024 09:38:37 +0100 Subject: [PATCH] Migrate CI to shared GHA action --- .github/workflows/main.yml | 78 ++++++++------------------------------ 1 file changed, 15 insertions(+), 63 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index deaf6e7..d9a8754 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,67 +1,19 @@ name: CI -on: [push, pull_request] +on: + pull_request: + push: + branches: + - 'develop' + - 'v*' -jobs: - tests: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - ruby: - - '2.7' - foreman: - - 'develop' - services: - postgres: - image: postgres:14 - env: - POSTGRES_USER: foreman - POSTGRES_PASSWORD: foreman - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - env: - BUNDLE_WITHOUT: "journald:development:mysql2:console" - TESTOPTS: "-v" - DATABASE_URL: "postgresql://foreman:foreman@localhost/test" - FOREMAN_PLUGIN_NAME: "foreman_azure_rm" - steps: - - name: Install package dependencies - run: | - sudo apt-get update - sudo apt-get install -yyq libsqlite3-dev zlib1g-dev libvirt-dev libcurl4-openssl-dev - - name: Checkout Foreman - uses: actions/checkout@v4 - with: - repository: theforeman/foreman - ref: ${{ matrix.foreman }} - - name: Checkout Plugin - uses: actions/checkout@v4 - with: - path: plugin - - name: Setup Plugin - run: echo "gemspec :path => './plugin'" > bundler.d/plugin.local.rb - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Set up NodeJS - uses: actions/setup-node@v4 - with: - node-version: '12' - - name: Install NodeJS dependencies - run: npm install +concurrency: + group: ${{ github.ref_name }}-${{ github.workflow }} + cancel-in-progress: true - - name: Run tests - run: | - bundle exec rake db:create RAILS_ENV=test - bundle exec rake webpack:compile - bundle exec rake db:migrate RAILS_ENV=test - bundle exec rake test:${FOREMAN_PLUGIN_NAME} - bundle exec rake "plugin:assets:precompile[${FOREMAN_PLUGIN_NAME}]" RAILS_ENV=production +jobs: + test: + name: Ruby + uses: theforeman/actions/.github/workflows/foreman_plugin.yml@v0 + with: + plugin: foreman_azure_rm