forked from opf/openproject
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (97 loc) · 3.31 KB
/
test-core.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: "Test suite"
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests
on:
push:
branches:
- dev
- release/*
paths-ignore:
- 'docs/**'
- 'help/**'
pull_request:
types: [opened, reopened, synchronize]
paths-ignore:
- 'docs/**'
- 'help/**'
- 'packaging/**'
- '.pkgr.yml'
permissions:
contents: read
jobs:
all:
name: Units + Features
if: github.repository == 'opf/openproject'
runs-on: runs-on,runner=32cpu-linux-x64,run-id=${{ github.run_id }}
timeout-minutes: 40
env:
DOCKER_BUILDKIT: 1
CI_RETRY_COUNT: 3
steps:
- uses: actions/checkout@v4
- name: Cache DOCKER
id: cache_docker
uses: runs-on/cache@v4
with:
path: cache/docker
# Note: no restore keys since whenever the files below change, we want to rebuild the full image from scratch
key: ${{ runner.os }}-docker-ci-${{ hashFiles('docker-compose.ci.yml', 'docker/ci/*', '.ruby-version', 'bin/ci') }}
- name: Restore CI image from cache
if: steps.cache_docker.outputs.cache-hit == 'true'
run: docker load -i cache/docker/image.tar
- name: Cache GEM
uses: runs-on/cache@v4
with:
path: cache/bundle
key: gem-${{ hashFiles('.ruby-version') }}-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
gem-${{ hashFiles('.ruby-version') }}-
- name: Cache NPM
uses: runs-on/cache@v4
with:
path: cache/node
key: node-${{ hashFiles('package.json', 'frontend/package-lock.json') }}
restore-keys: |
node-
- name: Cache ANGULAR
uses: runs-on/cache@v4
with:
path: cache/angular
key: angular-${{ hashFiles('package.json', 'frontend/package-lock.json') }}
restore-keys: |
angular-
- name: Cache TEST RUNTIME
uses: runs-on/cache@v4
with:
path: cache/runtime-logs
key: runtime-logs-${{ github.head_ref || github.ref }}-${{ github.sha }}
restore-keys: |
runtime-logs-${{ github.head_ref || github.ref }}-
runtime-logs-
- name: Build
run: bin/ci setup-tests
- name: APIv3 specification (OpenAPI 3.0)
run: bin/ci ./script/api/validate_spec
- name: Unit tests
run: bin/ci run-units
- name: Feature tests
env:
CAPYBARA_DOWNLOADED_FILE_DIR: /tmp/ci/downloads
CAPYBARA_AWS_ACCESS_KEY_ID: "${{ secrets.CAPYBARA_AWS_ACCESS_KEY_ID }}"
CAPYBARA_AWS_SECRET_ACCESS_KEY: "${{ secrets.CAPYBARA_AWS_SECRET_ACCESS_KEY }}"
run: bin/ci run-features
- name: Save CI image to cache
if: steps.cache_docker.outputs.cache-hit != 'true'
run: mkdir -p cache/docker && docker save openproject/ci:v1 -o cache/docker/image.tar
- name: Cleanup
if: ${{ always() }}
run: |
ls -al cache/runtime-logs || true
ls -al cache/ || true
du -sh cache/* || true
# github.head_ref is only availabe in PR context and if it is absent then github.run_id
# is used . And github.run_id is unique for each workflow run. So, this option makes
# sure that there is only one build running for a pull request and the build is attached
# to the last commit of the PR.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true