Skip to content

Bump actions/upload-artifact from 3 to 4 #130

Bump actions/upload-artifact from 3 to 4

Bump actions/upload-artifact from 3 to 4 #130

Workflow file for this run

name: Test
on: [push]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
env:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_PATH: "vendor/bundle"
BUNDLE_BUILD__SASSC: "--disable-march-tune-native"
BUNDLE_FROZEN: "true"
steps:
- name: Checkout code
uses: actions/checkout@v3
# Dependencies
- name: "Ruby: Install Ruby"
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: "Javascript: Set Node version"
id: node-version
run: echo "::set-output name=value::$(cat .node-version)"
- name: "Javascript: Install Node"
uses: actions/setup-node@v3
with:
node-version: ${{ steps.node-version.outputs.value }}
- name: "Javascript: Set Yarn cache location"
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: "Javascript: Cache packages"
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: "Javascript: Install packages"
run: yarn install --pure-lockfile
# /Dependencies
- name: Run Linters
run: bin/lint --nofix
test:
name: Test
runs-on: ubuntu-latest
env:
PGHOST: localhost
PGUSER: open311status
RAILS_ENV: test
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_PATH: "vendor/bundle"
BUNDLE_BUILD__SASSC: "--disable-march-tune-native"
BUNDLE_FROZEN: "true"
services:
postgres:
image: postgis/postgis:10-2.5
env:
POSTGRES_DB: open311status_test
POSTGRES_USER: open311status
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
ports: ["5432:5432"]
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v3
# Dependencies
- name: "Ruby: Install Ruby"
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: "Javascript: Set Node version"
id: node-version
run: echo "::set-output name=value::$(cat .node-version)"
- name: "Javascript: Install Node"
uses: actions/setup-node@v3
with:
node-version: ${{ steps.node-version.outputs.value }}
- name: "Javascript: Set Yarn cache location"
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: "Javascript: Cache packages"
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: "Javascript: Install packages"
run: yarn install --pure-lockfile
# /Dependencies
- name: Setup test database
run: bin/rails db:test:prepare
- name: Compile assets
run: bin/rails assets:precompile
- name: Run tests
run: RAILS_ENV=test bin/rspec
- name: Archive system spec screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots
path: tmp/screenshots/
deploy_flyio:
name: "Deploy to Fly.io"
if: github.ref == 'refs/heads/main'
needs: [test, lint]
runs-on: ubuntu-latest
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only