This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 71
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
9 changed files
with
324 additions
and
337 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,198 @@ | ||
name: CI/CD | ||
on: | ||
push: | ||
branches: | ||
- development | ||
- master | ||
pull_request: | ||
jobs: | ||
test: | ||
name: Run JS/Python/Cypress tests | ||
if: github.event.head_commit.author.email != 'action@github.com' | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7.x | ||
architecture: x64 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- name: Install dependencies | ||
run: | | ||
pip install pipenv | ||
pipenv install --dev --system | ||
cd game_frontend | ||
yarn --frozen-lockfile | ||
- name: Run Javascript tests | ||
run: | | ||
cd game_frontend | ||
yarn lint | ||
yarn test --coverage | ||
- name: Bundle Frontend | ||
env: | ||
NODE_ENV: production | ||
run: | | ||
cd game_frontend | ||
node djangoBundler.js | ||
- name: Run Python tests | ||
run: python all_tests.py -c --no-docker-container-tests | ||
- name: Run Cypress tests | ||
uses: cypress-io/github-action@v2 | ||
with: | ||
install: false | ||
start: python ../run.py -c | ||
working-directory: game_frontend | ||
wait-on: http://localhost:8000 | ||
wait-on-timeout: 400 | ||
record: true | ||
env: | ||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
|
||
test-aimmo-game: | ||
name: Test aimmo-game | ||
if: github.event.head_commit.author.email != 'action@github.com' | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build docker image | ||
run: | | ||
cd aimmo-game | ||
docker build -t ocadotechnology/aimmo-game:test --target tester . | ||
- name: Run tests | ||
run: docker run -i -p 5000:5000 ocadotechnology/aimmo-game:test /bin/bash -c "coverage run setup.py test && coverage xml" | ||
- name: Get the coverage data from the container | ||
run: | | ||
read CONTAINERID <<< $(docker ps --all -q | head -1) | ||
docker cp -a $CONTAINERID:.coverage $(pwd)/.coverage | ||
docker cp -a $CONTAINERID:coverage.xml $(pwd)/coverage.xml | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
|
||
test-aimmo-game-creator: | ||
name: Test aimmo-game-creator | ||
if: github.event.head_commit.author.email != 'action@github.com' | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build docker image | ||
run: | | ||
cd aimmo-game-creator | ||
docker build -t ocadotechnology/aimmo-game-creator:test --target tester . | ||
- name: Run tests | ||
run: docker run -i -p 5000:5000 ocadotechnology/aimmo-game-creator:test /bin/bash -c "coverage run setup.py test && coverage xml" | ||
- name: Get the coverage data from the container | ||
run: | | ||
read CONTAINERID <<< $(docker ps --all -q | head -1) | ||
docker cp -a $CONTAINERID:.coverage $(pwd)/.coverage | ||
docker cp -a $CONTAINERID:coverage.xml $(pwd)/coverage.xml | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
|
||
test-aimmo-game-worker: | ||
name: Test aimmo-game-worker | ||
if: github.event.head_commit.author.email != 'action@github.com' | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Build docker image | ||
run: | | ||
cd aimmo-game-worker | ||
docker build -t ocadotechnology/aimmo-game-worker:test --target tester . | ||
- name: Run tests | ||
run: docker run -i -p 5000:5000 ocadotechnology/aimmo-game-worker:test /bin/bash -c "coverage run setup.py test && coverage xml" | ||
- name: Get the coverage data from the container | ||
run: | | ||
read CONTAINERID <<< $(docker ps --all -q | head -1) | ||
docker cp -a $CONTAINERID:.coverage $(pwd)/.coverage | ||
docker cp -a $CONTAINERID:coverage.xml $(pwd)/coverage.xml | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v1 | ||
|
||
publish-python: | ||
name: Publish aimmo PyPi package | ||
needs: | ||
[test, test-aimmo-game, test-aimmo-game-creator, test-aimmo-game-worker] | ||
if: github.event_name == 'push' && github.event.head_commit.author.email != 'action@github.com' | ||
runs-on: ubuntu-18.04 | ||
env: | ||
NODE_ENV: production | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.7.x | ||
- name: Use Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- name: Install frontend dependencies | ||
run: | | ||
cd game_frontend | ||
yarn --frozen-lockfile | ||
- name: Install wheel | ||
run: pip install wheel | ||
- name: Build worker wheel | ||
run: ./aimmo_runner/build_worker_wheel.sh | ||
- name: Bundle Frontend | ||
run: | | ||
cd game_frontend | ||
node djangoBundler.js | ||
- name: Set branch | ||
id: branch | ||
run: | | ||
echo "::set-output name=branch::${GITHUB_REF##*/}" # get the substring from GITHUB_REF after the last '/' | ||
- name: Release aimmo | ||
uses: ocadotechnology/python-semantic-release@updated-beta-releases | ||
with: | ||
github_token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | ||
pypi_token: ${{ secrets.PYPI_TOKEN }} | ||
branch: ${{ steps.branch.outputs.branch }} | ||
build: ${{ github.run_number }} | ||
|
||
merge-master-into-development: | ||
name: Merge master into development after release | ||
needs: [publish-python] | ||
if: github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout development branch | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
ref: development | ||
persist-credentials: false | ||
- name: Setup git username | ||
run: | | ||
git config --global user.name "github-actions" | ||
git config --global user.email "action@github.com" | ||
- name: Merge master into development | ||
run: | | ||
git merge origin/master | ||
git remote add authed-origin https://${GH_TOKEN}@github.com/ocadotechnology/aimmo.git > /dev/null 2>&1 | ||
git push --quiet --set-upstream authed-origin development | ||
env: | ||
GH_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.