-
Notifications
You must be signed in to change notification settings - Fork 11
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
Showing
3 changed files
with
112 additions
and
113 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,109 +1,109 @@ | ||
name: Smoke Tests | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
smoke_tests: | ||
name: Smoke tests @ Nexus ${{ matrix.nexus_version }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
nexus_version: [3.34.1] | ||
|
||
steps: | ||
- name: Fetch sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup JDK 8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
|
||
- name: Cache local Maven repository | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
~/.m2/wrapper | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
- name: Configure build metadata | ||
id: metadata | ||
run: echo ::set-output name=tag::1.0.0 | ||
|
||
# - name: Install Cypress | ||
# run: npm install -g [email protected] | ||
|
||
# - name: Build plugin | ||
# env: | ||
# TEST_SNYK_TOKEN: ${{ secrets.TEST_SNYK_TOKEN }} | ||
# TEST_SNYK_ORG: ${{ secrets.TEST_SNYK_ORG }} | ||
# run: | | ||
# ./mvnw clean verify -DskipTests --show-version --batch-mode --errors -PbuildKar -Drevision=${{ steps.metadata.outputs.tag }} | ||
# ls -la ${GITHUB_WORKSPACE}/plugin/target/nexus-snyk-security-plugin-bundle.kar | ||
|
||
# - name: Start the Nexus container with Snyk plugin mounted | ||
# run: docker run -d --name nexus -p 8081:8081 -v ${GITHUB_WORKSPACE}/plugin/target/nexus-snyk-security-plugin-bundle.kar:/opt/sonatype/nexus/deploy/nexus-snyk-security-plugin-bundle.kar sonatype/nexus3 | ||
|
||
# - name: Wait for Nexus start | ||
# run: npx wait-on --timeout 120000 --interval 2000 http://localhost:8081/ | ||
|
||
# - name: Wait for API status endpoint | ||
# run: npx wait-on --timeout 120000 --interval 2000 http://localhost:8081/service/rest/v1/status/writable | ||
|
||
# - name: Run Cypress to log in to Nexus and set up Snyk plugin | ||
# working-directory: test/smoke | ||
# run: | | ||
# docker exec nexus cat /nexus-data/admin.password > /tmp/password | ||
# export NEXUS_PASS=$(cat /tmp/password) | ||
# echo $NEXUS_PASS | ||
# cat /tmp/password | ||
# cypress run | ||
# env: | ||
# TEST_SNYK_TOKEN: ${{ secrets.TEST_SNYK_TOKEN }} | ||
# TEST_SNYK_ORG: ${{ secrets.TEST_SNYK_ORG }} | ||
|
||
- name: Setup npm | ||
run: npm install | ||
|
||
# - name: Lint Node.js | ||
# run: npm run lint:formatting | ||
|
||
- name: Run Jest tests against running Nexus | ||
run: | | ||
export NEXUS_PASS=$(cat /tmp/password) | ||
npm run test | ||
- uses: actions/upload-artifact@v2 | ||
if: always() | ||
with: | ||
name: screenshots | ||
path: /home/runner/work/nexus-snyk-security-plugin/nexus-snyk-security-plugin/test/smoke/cypress/screenshots/cypress-test.spec.js/ | ||
retention-days: 1 | ||
|
||
- uses: actions/upload-artifact@v2 | ||
if: always() | ||
with: | ||
name: video | ||
path: /home/runner/work/nexus-snyk-security-plugin/nexus-snyk-security-plugin/test/smoke/cypress/videos/cypress-test.spec.js.mp4 | ||
retention-days: 1 | ||
|
||
- name: Save docker logs to file | ||
uses: jwalton/gh-docker-logs@v1 | ||
with: | ||
dest: "./logs" | ||
|
||
- name: Find any Snyk plugin errors in docker logs | ||
run: "! grep -Hrni snyk ./logs | grep -i error" | ||
|
||
- name: Dump docker logs (on success) | ||
uses: jwalton/gh-docker-logs@v1 | ||
|
||
- name: Dump docker logs (on failure) | ||
if: failure() | ||
uses: jwalton/gh-docker-logs@v1 | ||
name: Smoke Tests | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
smoke_tests: | ||
name: Smoke tests @ Nexus ${{ matrix.nexus_version }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
nexus_version: [3.34.1] | ||
|
||
steps: | ||
- name: Fetch sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup JDK 8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
|
||
- name: Cache local Maven repository | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.m2/repository | ||
~/.m2/wrapper | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
- name: Configure build metadata | ||
id: metadata | ||
run: echo ::set-output name=tag::1.0.0 | ||
|
||
- name: Install Cypress | ||
run: npm install -g [email protected] | ||
|
||
- name: Build plugin | ||
env: | ||
TEST_SNYK_TOKEN: ${{ secrets.TEST_SNYK_TOKEN }} | ||
TEST_SNYK_ORG: ${{ secrets.TEST_SNYK_ORG }} | ||
run: | | ||
./mvnw clean verify -DskipTests --show-version --batch-mode --errors -PbuildKar -Drevision=${{ steps.metadata.outputs.tag }} | ||
ls -la ${GITHUB_WORKSPACE}/plugin/target/nexus-snyk-security-plugin-bundle.kar | ||
- name: Start the Nexus container with Snyk plugin mounted | ||
run: docker run -d --name nexus -p 8081:8081 -v ${GITHUB_WORKSPACE}/plugin/target/nexus-snyk-security-plugin-bundle.kar:/opt/sonatype/nexus/deploy/nexus-snyk-security-plugin-bundle.kar sonatype/nexus3 | ||
|
||
- name: Wait for Nexus start | ||
run: npx wait-on --timeout 120000 --interval 2000 http://localhost:8081/ | ||
|
||
- name: Wait for API status endpoint | ||
run: npx wait-on --timeout 120000 --interval 2000 http://localhost:8081/service/rest/v1/status/writable | ||
|
||
- name: Run Cypress to log in to Nexus and set up Snyk plugin | ||
working-directory: test/smoke | ||
run: | | ||
docker exec nexus cat /nexus-data/admin.password > /tmp/password | ||
export NEXUS_PASS=$(cat /tmp/password) | ||
echo $NEXUS_PASS | ||
cat /tmp/password | ||
cypress run --headless --browser chrome | ||
env: | ||
TEST_SNYK_TOKEN: ${{ secrets.TEST_SNYK_TOKEN }} | ||
TEST_SNYK_ORG: ${{ secrets.TEST_SNYK_ORG }} | ||
|
||
- name: Setup npm | ||
run: npm install | ||
|
||
- name: Lint Node.js | ||
run: npm run lint:formatting | ||
|
||
- name: Run Jest tests against running Nexus | ||
run: | | ||
export NEXUS_PASS=$(cat /tmp/password) | ||
npm run test | ||
- uses: actions/upload-artifact@v2 | ||
if: always() | ||
with: | ||
name: screenshots | ||
path: /home/runner/work/nexus-snyk-security-plugin/nexus-snyk-security-plugin/test/smoke/cypress/screenshots/cypress-test.spec.js/ | ||
retention-days: 1 | ||
|
||
- uses: actions/upload-artifact@v2 | ||
if: always() | ||
with: | ||
name: video | ||
path: /home/runner/work/nexus-snyk-security-plugin/nexus-snyk-security-plugin/test/smoke/cypress/videos/cypress-test.spec.js.mp4 | ||
retention-days: 1 | ||
|
||
- name: Save docker logs to file | ||
uses: jwalton/gh-docker-logs@v1 | ||
with: | ||
dest: "./logs" | ||
|
||
- name: Find any Snyk plugin errors in docker logs | ||
run: "! grep -Hrni snyk ./logs | grep -i error" | ||
|
||
- name: Dump docker logs (on success) | ||
uses: jwalton/gh-docker-logs@v1 | ||
|
||
- name: Dump docker logs (on failure) | ||
if: failure() | ||
uses: jwalton/gh-docker-logs@v1 |
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