From b5d72a29fc39a7b4642a899554e97c76ec55b67a Mon Sep 17 00:00:00 2001 From: Sean T Allen Date: Sat, 16 Sep 2023 14:09:04 -0400 Subject: [PATCH] Add superlinter (#134) This PR includes updates needed to make the linting pass. Closes #133 --- .github/workflows/docker-image-builds.yml | 16 ------------ .github/workflows/pr.yml | 31 ++++++++++++++++++++++ INSTALL.md | 32 +++++++++++------------ README.md | 17 ++++++------ 4 files changed, 56 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/docker-image-builds.yml create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/docker-image-builds.yml b/.github/workflows/docker-image-builds.yml deleted file mode 100644 index 5aa42e1..0000000 --- a/.github/workflows/docker-image-builds.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Docker image builds - -on: pull_request - -concurrency: - group: pr-${{ github.ref }} - cancel-in-progress: true - -jobs: - validate-docker-image-builds: - name: Validate Docker image builds - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Docker build - run: "docker build --pull docker/." diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..5b91737 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,31 @@ +name: PR + +on: pull_request + +concurrency: + group: pr-${{ github.ref }} + cancel-in-progress: true + +jobs: + superlinter: + name: Lint bash, docker, markdown, and yaml + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Lint codebase + uses: docker://github/super-linter:v3.8.3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VALIDATE_ALL_CODEBASE: true + VALIDATE_BASH: true + VALIDATE_DOCKERFILE: true + VALIDATE_MD: true + VALIDATE_YAML: true + + validate-docker-image-builds: + name: Validate Docker image builds + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Docker build + run: "docker build --pull docker/." diff --git a/INSTALL.md b/INSTALL.md index bd0a37a..a2cf2df 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -2,7 +2,7 @@ ## From Ubuntu 18.04 -``` +```bash # let's update first sudo apt-get update @@ -25,11 +25,11 @@ sudo pip install pygments ### Install Docker -See https://docs.docker.com/engine/install/ubuntu/ +See the [Docker installation directions](https://docs.docker.com/engine/install/ubuntu/). It boils down to: -``` +```bash # cleanup old stuff sudo apt-get remove docker docker-engine docker.io containerd runc @@ -49,7 +49,7 @@ sudo apt-get install -y docker-ce docker-ce-cli containerd.io ### Webserver setup -``` +```bash add-apt-repository ppa:certbot/certbot apt-get update apt-get install -y nginx python-certbot-nginx @@ -57,7 +57,7 @@ apt-get install -y nginx python-certbot-nginx Create /etc/nginx/sites-enabled/playground.ponylang.io.conf -``` +```text server { listen 80 default_server; listen [::]:80 default_server; @@ -70,7 +70,7 @@ server { } ``` -``` +```bash rm /etc/nginx/sites-enabled/default ln -sf /etc/nginx/sites-available/playground.ponylang.io.conf /etc/nginx/sites-enabled/playground.ponylang.io.conf @@ -79,27 +79,27 @@ nginx -t && nginx -s reload ### SSL setup -``` +```bash certbot --nginx -d playground.ponylang.io -m ponylang.main@gmail.com ``` crontab -e -``` +```text 0 12 * * * /usr/bin/certbot renew --quiet 05 12 * * * systemctl restart playground ``` ### Start docker -``` +```bash systemctl enable docker systemctl start docker ``` ### Install rust -``` +```bash curl https://sh.rustup.rs | sh ``` @@ -108,7 +108,7 @@ select `1` from prompt As this file might be outdated, make sure the version here corresponds to the version listed in the `rust-toolchain` file of this repo. -``` +```bash source /root/.profile rustup install 1.60.0 rustup default 1.60.0 @@ -116,7 +116,7 @@ rustup default 1.60.0 ### Build playground image -``` +```bash git clone https://github.com/ponylang/pony-playground.git cd pony-playground docker build docker --pull -t ponylang-playpen @@ -131,7 +131,7 @@ Should ONLY be the token, not "user:token" ### Build it -``` +```bash cargo build --release --bin playpen ``` @@ -139,7 +139,7 @@ cargo build --release --bin playpen Put the following in the file `/etc/systemd/system/playground.service`, put in the generated GITHUB_TOKEN from above: -``` +```text [Unit] Description=Pony Playground Systemd Service Unit Requires=docker.service @@ -156,14 +156,14 @@ WantedBy=multi-user.target ### Enable and Run it -``` +```bash systemctl enable playground systemctl start playground ``` STDOUT and STDERR both go the journal. If you want to investigate logs, use: -``` +```bashP journalctl -u playground ... ``` diff --git a/README.md b/README.md index 7cba338..92af858 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +# Pony Playground + A web interface for running Pony code. Heavily based upon the [rust playpen](https://github.com/rust-lang/rust-playpen). @@ -17,26 +19,25 @@ See [INSTALL.md](INSTALL.md) for installation instructions for a real box. First, create the Docker image that playpen will use: -``` +```bash docker build docker -t ponylang-playpen ``` -Get a github personal access token. Only the `gist` scope needs to be selected. -Put it into the `GITHUB_TOKEN` environment variable. +Get a github personal access token. Only the `gist` scope needs to be selected. +Put it into the `GITHUB_TOKEN` environment variable. -``` +```text export GITHUB_TOKEN="..." ``` It will be used for creating gists with the playgrounds contents. -If you want to test without a valid token, really all you need to do +If you want to test without a valid token, really all you need to do is to set the variable to some gibberish. Next, spin up the server. -``` +```bash cargo run --bin playpen ``` -You should now be able to browse http://127.0.0.1:8000 and play. - +You should now be able to browse [localhost on port 8000](http://127.0.0.1:8000) and play.