* Additional Integration tests (#123)

* Update integration-beta.yml

* git fetch again

* git fetch

* Tests

* Failing Build (#124)
This commit is contained in:
James Ives 2020-01-14 15:17:26 -05:00 committed by GitHub
parent 147848b4e0
commit c7f288e7c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 123 additions and 11 deletions

109
.github/workflows/integration-beta.yml vendored Normal file
View File

@ -0,0 +1,109 @@
name: integration-tests-beta
on:
schedule:
- cron: 10 15 * * 0-6
push:
branches:
- dev
- releases/v3
- releases/v3-test
jobs:
# Deploys using checkout@v1 with an ACCESS_TOKEN.
integration-checkout-v1:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages-beta
FOLDER: integration
BASE_BRANCH: dev
TARGET_FOLDER: montezuma
# Deploys using checkout@v2 with a GITHUB_TOKEN.
integration-checkout-v2:
needs: integration-checkout-v1
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages-beta
FOLDER: integration
BASE_BRANCH: dev
TARGET_FOLDER: montezuma2
# Deploys using a container that requires you to install rsync.
integration-container:
needs: integration-checkout-v2
runs-on: ubuntu-latest
container:
image: ruby:2.6
env:
LANG: C.UTF-8
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install rsync
run: |
apt-get update && apt-get install -y rsync
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages-beta
FOLDER: integration
BASE_BRANCH: dev
TARGET_FOLDER: montezuma2
# Deploys using the CLEAN option.
integration-clean:
needs: [integration-checkout-v1, integration-checkout-v2, integration-container]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages-beta
FOLDER: integration
BASE_BRANCH: dev
CLEAN: true
# Deploys to a branch that doesn't exist.
integration-branch-creation:
needs: [integration-checkout-v1, integration-checkout-v2]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: integration-test-delete-test
FOLDER: integration
BASE_BRANCH: dev
CLEAN: true
- name: Cleanup Generated Branch
uses: dawidd6/action-delete-branch@v2.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: integration-test-delete-test

View File

@ -6,7 +6,6 @@ on:
branches:
- dev
- releases/v3
- releases/v3-test
jobs:
# Deploys using checkout@v1 with an ACCESS_TOKEN.
@ -17,7 +16,7 @@ jobs:
uses: actions/checkout@v1
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
@ -34,7 +33,7 @@ jobs:
uses: actions/checkout@v2
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
@ -60,7 +59,7 @@ jobs:
apt-get update && apt-get install -y rsync
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
@ -77,7 +76,7 @@ jobs:
uses: actions/checkout@v1
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: gh-pages
@ -94,10 +93,10 @@ jobs:
uses: actions/checkout@v1
- name: Build and Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3-test
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: integration-test-delete-test
BRANCH: integration-test-delete-prod
FOLDER: integration
BASE_BRANCH: dev
CLEAN: true
@ -106,4 +105,4 @@ jobs:
uses: dawidd6/action-delete-branch@v2.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branches: integration-test-delete-test
branches: integration-test-delete-prod

View File

@ -30,7 +30,7 @@ describe("git", () => {
});
const call = await init();
expect(execute).toBeCalledTimes(4);
expect(execute).toBeCalledTimes(6);
expect(call).toBe("Initialization step complete...");
});
@ -46,7 +46,7 @@ describe("git", () => {
const call = await init();
expect(execute).toBeCalledTimes(4);
expect(execute).toBeCalledTimes(6);
expect(call).toBe("Initialization step complete...");
});
@ -109,7 +109,7 @@ describe("git", () => {
const call = await init();
expect(execute).toBeCalledTimes(4);
expect(execute).toBeCalledTimes(6);
expect(call).toBe("Initialization step complete...");
});
});

View File

@ -36,6 +36,8 @@ function init() {
yield execute_1.execute(`git init`, constants_1.workspace);
yield execute_1.execute(`git config user.name ${constants_1.action.name}`, constants_1.workspace);
yield execute_1.execute(`git config user.email ${constants_1.action.email}`, constants_1.workspace);
yield execute_1.execute(`git remote rm origin`, constants_1.workspace);
yield execute_1.execute(`git remote add origin ${constants_1.repositoryPath}`, constants_1.workspace);
yield execute_1.execute(`git fetch`, constants_1.workspace);
}
catch (error) {

View File

@ -26,6 +26,8 @@ export async function init(): Promise<any> {
await execute(`git init`, workspace);
await execute(`git config user.name ${action.name}`, workspace);
await execute(`git config user.email ${action.email}`, workspace);
await execute(`git remote rm origin`, workspace);
await execute(`git remote add origin ${repositoryPath}`, workspace);
await execute(`git fetch`, workspace);
} catch (error) {
core.setFailed(`There was an error initializing the repository: ${error}`);