Checks #337
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: Checks | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
schedule: | |
- cron: 49 3 * * * | |
workflow_dispatch: | |
inputs: | |
bleeding_edge: | |
type: boolean | |
default: false | |
description: Run with gems from git sources | |
permissions: | |
contents: read | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
# Allow disabling scheduled runs when an issue has been found. Also stops it from running on forks. | |
# Configure at https://github.com/Earlopain/FoxTrove/settings/variables/actions | |
if: (github.event_name == 'schedule' && vars.ALLOW_SCHEDULED_RUN == 'true') || github.event_name != 'schedule' | |
env: | |
BLEEDING_EDGE: ${{ (inputs.bleeding_edge == true || github.event_name == 'schedule') && 'true' || 'false' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- if: env.BLEEDING_EDGE == 'true' | |
uses: ruby/setup-ruby@v1 | |
- if: env.BLEEDING_EDGE == 'true' | |
name: Use git gem sources | |
env: | |
GEM_OVERRIDES: ${{ vars.GEM_OVERRIDES }} | |
# https://github.com/rubygems/rubygems/issues/8238 | |
run: ruby .github/bleeding_edge.rb && bundle lock --update && cat Gemfile.lock | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
load: true | |
tags: foxtrove | |
build-args: | | |
BASE_IMAGE=${{ env.BLEEDING_EDGE == 'true' && 'ghcr.io/docker-ruby-nightly/ruby:alpine3.20-nightly' || ''}} | |
- name: Set env file | |
run: | | |
cat <<EOT >> .env | |
FOXTROVE_DATA_PATH=${{ runner.temp }}/foxtrove | |
CI=1 | |
${{ env.BLEEDING_EDGE == 'true' && 'BLEEDING_EDGE=true' || ''}} | |
EOT | |
- name: Create DB | |
run: docker compose run foxtrove bin/setup | |
- name: Run Tests | |
run: docker compose run -e CI -e BLEEDING_EDGE tests | |
- if: env.BLEEDING_EDGE == 'false' | |
name: Upload Coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
rubocop: | |
runs-on: ubuntu-latest | |
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Run Rubocop | |
run: bundle exec rubocop --format github | |
docker-checks: | |
runs-on: ubuntu-latest | |
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch' | |
name: Run ${{ matrix.service }} | |
strategy: | |
fail-fast: false | |
matrix: | |
service: [yamllint, csslint, tslint] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run ${{ matrix.service }} | |
run: docker compose run ${{ matrix.service }} |