Release/0.2.0 #27
This file contains hidden or 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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| # Run tests on ALL pull requests, regardless of target branch | |
| release: | |
| types: [ published ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| matrix: | |
| ruby-version: ['3.0', '3.1', '3.2'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Ruby ${{ matrix.ruby-version }} | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: | | |
| bundle install --jobs 4 --retry 3 | |
| bundle list | |
| - name: Run tests | |
| run: bundle exec rake spec | |
| - name: Run CLI tests | |
| run: | | |
| # Test basic CLI functionality with bundler context | |
| bundle exec ruby -Ilib exe/issuer --version | |
| bundle exec ruby -Ilib exe/issuer --help | |
| bundle exec ruby -Ilib exe/issuer examples/minimal-example.yml --dry | |
| gem-build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'release' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| - name: Build gem | |
| run: gem build issuer.gemspec | |
| # - name: Publish to RubyGems | |
| # run: | | |
| # mkdir -p ~/.gem | |
| # echo ":rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }}" > ~/.gem/credentials | |
| # chmod 0600 ~/.gem/credentials | |
| # gem push issuer-*.gem | |
| # env: | |
| # RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} | |
| docker-build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'release' || github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: docopslab/issuer | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=pr | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| # - name: Build and push Docker image | |
| # uses: docker/build-push-action@v5 | |
| # with: | |
| # context: . | |
| # push: true | |
| # tags: ${{ steps.meta.outputs.tags }} | |
| # labels: ${{ steps.meta.outputs.labels }} | |
| # cache-from: type=gha | |
| # cache-to: type=gha,mode=max | |
| integration-test: | |
| runs-on: ubuntu-latest | |
| needs: docker-build | |
| if: github.event_name == 'release' || github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Test Docker image | |
| run: | | |
| # Test the Docker image with examples | |
| docker run --rm -v $(pwd):/workdir docopslab/issuer:latest issuer --version | |
| docker run --rm -v $(pwd):/workdir docopslab/issuer:latest issuer --help | |
| docker run --rm -v $(pwd):/workdir docopslab/issuer:latest issuer examples/minimal-example.yml --dry |