diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100755 index 0000000..35eba49 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,87 @@ +# Put this in the file: .github/workflows/verify.yml + +name: Verify +on: [push] + +jobs: + linters: + name: Linters + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Ruby and install gems + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 10.13.0 + - name: Find yarn cache location + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: JS package cache + uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Install packages + run: | + yarn install --pure-lockfile + + tests: + name: Tests + runs-on: ubuntu-latest + services: + postgres: + image: postgres:13 + env: + POSTGRES_USER: myapp + POSTGRES_DB: iot_administration_test + POSTGRES_PASSWORD: test + ports: ["5432:5432"] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Ruby and install gems + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 10.13.0 + - name: Find yarn cache location + id: yarn-cache + run: echo "::set-output name=dir::$(yarn cache dir)" + - name: JS package cache + uses: actions/cache@v1 + with: + path: ${{ steps.yarn-cache.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Install packages + run: | + yarn install --pure-lockfile + + - name: Setup test database + env: + RAILS_ENV: test + DB_HOST: localhost + DB_USER: myapp + DB_PASSWORD: test + run: | + bundle exec rails db:create + bundle exec rails db:schema:load + + - name: Run tests + run: bin/rspec \ No newline at end of file