-
Notifications
You must be signed in to change notification settings - Fork 4
68 lines (64 loc) · 2.3 KB
/
ci-cache.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: CI w/ cache
on:
# allow running action manually
workflow_dispatch:
# trigger on push to master branch
pull_request:
branches:
- master
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
#env:
# REGISTRY: ghcr.io
jobs:
CI:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
# - name: Log in to the Container registry
# uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
# with:
# registry: ${{ env.REGISTRY }}
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
- name: Create scholarspace folders
run: |
mkdir -p /opt/scholarspace
mkdir /opt/scholarspace/certs
mkdir /opt/scholarspace-tmp
mkdir /opt/scholarspace-minter
mkdir /opt/scholarspace/fedora-data
mkdir /opt/scholarspace/solr-data
mkdir /opt/scholarspace/scholarspace-ingest
cd /opt/scholarspace
# Checkout the repository code
- name: Check out repository code
uses: actions/checkout@v4
# Copy the pre-filled docker/ci.env file to use as the .env file for testing
- name: Create env file
run: |
cp docker/ci.env .env
- name: Build and cache Docker layers
uses: docker/bake-action@master
with:
push: false
load: true
files: |-
docker-compose.yml
docker/docker-compose-cache.json
# Start all of the docker containers and wait until positive response from healthchecks
- name: Start Docker containers
run: |
docker compose up --wait
- name: Create dev/test databases
run: |
docker exec $(docker ps --filter 'name=app' -q) bash -lc "bundle exec rails db:create"
- name: Migrate dev/test databases
run: |
docker exec $(docker ps --filter 'name=app' -q) bash -lc "bundle exec rails db:migrate"
- name: Run RSpec tests
run: |
docker exec $(docker ps --filter 'name=app' -q) bash -lc "bundle exec rspec"