-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bc404d
commit e5808aa
Showing
6 changed files
with
206 additions
and
131 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,192 @@ | ||
# This action is used for DrevOps maintenance. It will not be used in the scaffolded project. | ||
name: DrevOps - Test | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- develop | ||
- 'feature/**' | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
drevops-test-common: | ||
runs-on: ubuntu-latest | ||
|
||
container: | ||
image: drevops/ci-runner:latest | ||
env: | ||
# Prevent GitHub overriding the Docker config. | ||
DOCKER_CONFIG: /root/.docker | ||
DREVOPS_DOCTOR_CHECK_MINIMAL: 1 | ||
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} | ||
TEST_DOCKER_USER: ${{ secrets.TEST_DOCKER_USER }} | ||
TEST_DOCKER_PASS: ${{ secrets.TEST_DOCKER_PASS }} | ||
DREVOPS_DEV_VOLUMES_MOUNTED: 0 | ||
DREVOPS_DEV_TEST_COVERAGE_DIR: /tmp/.drevops-coverage-html | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
|
||
- name: Process codebase to run in CI | ||
run: find . -name "docker-compose.yml" -print0 | xargs -0 -I {} sh -c "sed -i -e ''/###/d'' {} && sed -i -e ''s/##//'' {}" | ||
|
||
- name: Adjust git config to allow running git-related tests | ||
run: git config --global safe.directory '*' | ||
|
||
- name: Generate test SSH key pair used for deployment tests | ||
run: | | ||
mkdir -p $HOME/.ssh | ||
ssh-keygen -t rsa -b 4096 -m PEM -N '' -f $HOME/.ssh/id_rsa | ||
chmod 600 $HOME/.ssh/id_rsa | ||
echo "$(ssh-agent -a ${HOME}/ssh-agent.sock)" > ssh-agent-output | ||
export SSH_AUTH_SOCK=$(grep SSH_AUTH_SOCK ssh-agent-output | cut -d';' -f1 | cut -d= -f2) | ||
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV | ||
- name: Install dependencies | ||
run: npm ci | ||
working-directory: .drevops/tests | ||
|
||
- name: Lint code | ||
run: | | ||
./tests/lint.scripts.sh | ||
./tests/lint.dockerfiles.sh | ||
./tests/lint.spelling.sh | ||
working-directory: .drevops | ||
|
||
- name: Run tests | ||
run: ./tests/test.common.sh | ||
working-directory: .drevops | ||
|
||
- name: Upload coverage report as an artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{github.job}}-code-coverage-report | ||
path: /tmp/.drevops-coverage-html | ||
|
||
- name: Upload coverage report to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
directory: /tmp/.drevops-coverage-html | ||
fail_ci_if_error: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
drevops-test-workflow: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
batch: [0, 1, 2] | ||
|
||
container: | ||
image: drevops/ci-runner:latest | ||
env: | ||
# Prevent GitHub overriding the Docker config. | ||
DOCKER_CONFIG: /root/.docker | ||
DREVOPS_DOCTOR_CHECK_MINIMAL: 1 | ||
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} | ||
TEST_DOCKER_USER: ${{ secrets.TEST_DOCKER_USER }} | ||
TEST_DOCKER_PASS: ${{ secrets.TEST_DOCKER_PASS }} | ||
DREVOPS_DEV_VOLUMES_MOUNTED: 0 | ||
DREVOPS_DEV_TEST_COVERAGE_DIR: /tmp/.drevops-coverage-html | ||
TEST_NODE_INDEX: ${{ matrix.batch }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
|
||
- name: Adjust git config to allow running git-related tests | ||
run: git config --global safe.directory '*' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
working-directory: .drevops/tests | ||
|
||
- name: Run tests | ||
run: ./tests/test.workflow.sh | ||
working-directory: .drevops | ||
|
||
- name: Upload coverage report as an artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{github.job}}-${{ matrix.batch }}-code-coverage-report | ||
path: /tmp/.drevops-coverage-html | ||
|
||
- name: Upload coverage report to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
directory: /tmp/.drevops-coverage-html | ||
fail_ci_if_error: true | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
drevops-test-deployment: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
batch: [0, 1] | ||
|
||
container: | ||
image: drevops/ci-runner:latest | ||
env: | ||
# Prevent GitHub overriding the Docker config. | ||
DOCKER_CONFIG: /root/.docker | ||
DREVOPS_DOCTOR_CHECK_MINIMAL: 1 | ||
TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} | ||
TEST_DOCKER_USER: ${{ secrets.TEST_DOCKER_USER }} | ||
TEST_DOCKER_PASS: ${{ secrets.TEST_DOCKER_PASS }} | ||
DREVOPS_DEV_VOLUMES_MOUNTED: 0 | ||
DREVOPS_DEV_TEST_COVERAGE_DIR: /tmp/.drevops-coverage-html | ||
TEST_NODE_INDEX: ${{ matrix.batch }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
|
||
- name: Adjust git config to allow running git-related tests | ||
run: git config --global safe.directory '*' | ||
|
||
- name: Generate test SSH key pair used for deployment tests | ||
run: | | ||
mkdir -p $HOME/.ssh | ||
ssh-keygen -t rsa -b 4096 -m PEM -N '' -f $HOME/.ssh/id_rsa | ||
chmod 600 $HOME/.ssh/id_rsa | ||
echo "$(ssh-agent -a ${HOME}/ssh-agent.sock)" > ssh-agent-output | ||
export SSH_AUTH_SOCK=$(grep SSH_AUTH_SOCK ssh-agent-output | cut -d';' -f1 | cut -d= -f2) | ||
echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> $GITHUB_ENV | ||
- name: Install dependencies | ||
run: npm ci | ||
working-directory: .drevops/tests | ||
|
||
- name: Run tests | ||
run: ./tests/test.deployment.sh | ||
working-directory: .drevops | ||
|
||
- name: Upload coverage report as an artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{github.job}}-${{ matrix.batch }}-code-coverage-report | ||
path: /tmp/.drevops-coverage-html | ||
|
||
- name: Upload coverage report to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
directory: /tmp/.drevops-coverage-html | ||
fail_ci_if_error: true | ||
token: ${{ secrets.CODECOV_TOKEN }} |
Oops, something went wrong.