Skip to content

Commit

Permalink
Merge branch 'master' into engine-plus-client-test-87
Browse files Browse the repository at this point in the history
  • Loading branch information
n8kim1 committed Jan 7, 2023
2 parents 3d970bd + 898b90a commit 1353928
Show file tree
Hide file tree
Showing 39 changed files with 368 additions and 2,050 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Release
on:
push:
tags:
- '*'

env:
# GCS_BUCKET is the name of the Google Cloud Storage bucket to which all artifacts are deployed.
GCS_BUCKET: mitbattlecode-releases

# RELEASE_ARTIFACT_ID is the name of the Maven artifact produced by the buildsystem.
# Important: you must make sure no ID is a prefix of a different ID. Otherwise, you could
# inadvertently cause unintended episodes to become public.
RELEASE_ARTIFACT_ID: battlecode22

# IS_PUBLIC is whether to release deployments publicly. Set to exactly the text "YES" to do so.
IS_PUBLIC: NO

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: Checkout branch
uses: actions/checkout@v3

- name: Get release version
run: |
release_version=${GITHUB_REF#refs/*/}
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
echo "The release version is $release_version"
- name: Authenticate to Google Cloud Platform
uses: google-github-actions/auth@v1
with:
create_credentials_file: true
workload_identity_provider: projects/830784087321/locations/global/workloadIdentityPools/releases/providers/github-workflow
service_account: [email protected]

- name: Set up Google Cloud SDK
uses: 'google-github-actions/setup-gcloud@v1'

- name: Set up Wine # See actions/runner-images#743
run: |
sudo dpkg --add-architecture i386
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo add-apt-repository ppa:cybermax-dexter/sdl2-backport
sudo apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu $(lsb_release -cs) main"
sudo apt install --install-recommends winehq-stable
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: 8
distribution: adopt

- name: Set up Node 16
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install schema
run: npm install
working-directory: ./schema

- name: Install client
run: npm run install-all
working-directory: ./client

- name: Publish to local repository
run: ./gradlew publishToMavenLocal -Prelease_version=$RELEASE_VERSION

- name: Build web client
run: npm run prod
working-directory: ./client/visualizer

- name: Determine access control
run: |
[[ "$IS_PUBLIC" = "YES" ]] && acl="public-read" || acl="project-private"
echo "OBJECT_ACL=$acl" >> $GITHUB_ENV
echo "Objects will be uploaded with ACL $acl"
- name: Upload maven artifacts to remote repository
run: gsutil -m rsync -a $OBJECT_ACL -r $HOME/.m2/repository/org/battlecode gs://$GCS_BUCKET/maven/org/battlecode

- name: Upload javadocs
run: |
unzip -d ${{ runner.temp }}/javadoc $HOME/.m2/repository/org/battlecode/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION/*-javadoc.jar
gsutil -m rsync -a $OBJECT_ACL -r ${{ runner.temp }}/javadoc gs://$GCS_BUCKET/javadoc/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION
- name: Upload specs
run: gsutil -m rsync -a $OBJECT_ACL -r ./specs gs://$GCS_BUCKET/specs/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION

- name: Upload web client
run: |
gsutil -m rsync -a $OBJECT_ACL out gs://$GCS_BUCKET/client/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION
gsutil cp -a $OBJECT_ACL visualizer.html gs://$GCS_BUCKET/client/$RELEASE_ARTIFACT_ID/$RELEASE_VERSION
working-directory: ./client/visualizer
62 changes: 0 additions & 62 deletions EMAILS.md

This file was deleted.

22 changes: 0 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ Instead, follow the instructions [here](https://play.battlecode.org/getting-star

## Development

### Website

While it isn't strictly necessary, running is easier with [Docker](https://docs.docker.com/get-docker/) installed. If you have Windows, I'd also recommend installing [Cygwin](https://www.cygwin.com/), since we have some scripts and programs that won't work with the standard Windows command prompt. (Docker is not strictly necessary, but it makes stuff easier, especially the backend.)

It's easiest to run the frontend and backend individually, in a separate terminal window for each. For instructions on how to do this, see each of their directories' readmes.

You could also run both the backend and the frontend in a single Docker container, by running `docker-compose up --build`. But, it's better to run them individuallly.

### Engine

Windows users: Instead of `./gradlew`, use `gradlew` for all commands.
Expand All @@ -50,20 +42,6 @@ npm run watch

which will launch the client on http://localhost:8080 (if available).

### Docs

You can generate javadocs as follows:

```
./gradlew release_docs_zip -Prelease_version=2020.0.0.0.0.1
```

This will create a `zip` file. Unzip and open the `index.html` file in it to view the docs. In particular, looking at the documentation for `RobotController` will be helpful.

To deploy these docs, get the above zip file, and unzip it. Rename the resulting folder to `javadoc`. Then, put it in `frontend/public`, suchh that there's a `frontend/public/javadoc/index.html`. Then run the frontend deploy process!

TODO -- these steps ought to simply be in the frontend deploy script.

## Notes for porting to a new repo

When the next edition of Battlecode comes around, it will probably useful to reuse a fair amount of this codebase. Maintaining git history is nice. Use `git-filter-repo` for this:
Expand Down
50 changes: 9 additions & 41 deletions RELEASE_JAVA.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,11 @@
# HOW TO RELEASE A JAVA GAME

## Prereqs

a bash-like shell (windows command prompt won't work for this). Also, zsh (and perhaps other shell environments) don't work to run the frontend deploy script. bash seems to work.

npm

a git key: Obtain a git key that has "publish packages" permissions. This key is a string. Keep it around somewhere

## Get updates

Make sure you have all the most recent updates to the repo! (Ideally they're pushed to git. Then do git checkout master, git fetch, git pull.)

## Update some version numbers

`client/visualizer/src/config` -- find ``gameVersion`, and update that.

`gradle.properties` -- update `release_version`.

Make sure these updates are pushed to master!

## Update specs and javadoc

In our game spec (specs folder), make sure changes are up to date.

Pay attention to the version number at the top of specs.md.html, and to the changelog at the bottom.

push to master btw!

## Release packages

Set BC21_GITUSERNAME: `export BC21_GITUSERNAME=n8kim1`, etc

Set BC21_GITKEY similarly. This git key is the string discussed above.

./gradlew publish

Now set version.txt in gcloud (also set cache policy to no-store)

## Deploy frontend

Run the deploy.sh script! For arguments, follow the instructions in the file. For example: `bash ./deploy.sh deploy 2021.3.0.2`
1. Update version numbers in the following places:
- `engine/src/main/battlecode/common/GameConstants.java`
- `client/visualizer/src/config.ts`
- Specs, both at the top and in the changelog.
2. Decide whether you want the release to be public.
- Check the value of `IS_PUBLIC` in `.github/workflows/release.yml`.
3. Create a Release on GitHub.
- The release tag-name will be the version number. For example: "1.0.3".
- You should use the version number as the release title too.
12 changes: 2 additions & 10 deletions RELEASE_PYTHON.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
# HOW TO RELEASE A PYTHON GAME

In general, this guide and script may be out of date. Make any changes as necessary.

### Preliminaries
- Install the frontend using `npm install`.
- Make sure that if you run `npm run start` in the `frontend` folder, you get a working frontend on `localhost:3000` after a few minutes.
- Install `pandoc` (e.g. using Homebrew)
- Use a bash shell (or something similar — e.g. zsh but not Windows Command Prompt).

### Release Procedure
- Make sure everything is up to date:
- `git pull`
- Choose a version as $major.$minor.$patch (e.g. 1.32.2)
- Run `./release.py $version`.
- Run `./release.py $version`. This script is now gone, but can be found
[here](https://github.com/battlecode/battlehack20/blob/master/release.py).
- Go on Discord and wait for things to catch on fire
Loading

0 comments on commit 1353928

Please sign in to comment.