Add support to 12 factor charm #415
Workflow file for this run
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
name: PR checks | |
on: pull_request | |
env: | |
SECRET_KEY: insecure_test_key | |
jobs: | |
imaging: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- id: commit | |
uses: prompt/actions-commit-hash@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
load: true | |
push: false | |
tags: canonical/dqlite.io:${{ steps.commit.outputs.short }} | |
- name: Run image | |
run: | | |
docker run -d -p 80:80 --env SECRET_KEY=insecure_secret_key dqlite-io | |
sleep 1 && curl --head --fail --retry-delay 5 --retry 10 --retry-connrefused http://localhost | |
- name: Push image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: canonical/dqlite.io:${{ steps.commit.outputs.short }} | |
login: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
run-dotrun: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dotrun | |
uses: canonical/install-dotrun@main | |
- name: Install dependencies | |
run: dotrun install | |
- name: Build assets | |
run: dotrun build | |
- name: Test site | |
run: dotrun & curl --head --fail --retry-delay 1 --retry 30 --retry-connrefused http://localhost:8037 | |
lint-python: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install node dependencies | |
run: yarn install --immutable | |
- name: Install python dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
sudo pip3 install flake8 black | |
- name: Lint python | |
run: yarn lint-python | |
lint-scss: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Lint scss | |
run: yarn lint-scss | |
test-python: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install requirements | |
run: | | |
sudo apt-get update && sudo apt-get install --yes python3-setuptools | |
sudo pip3 install -r requirements.txt | |
- name: Install dependencies | |
run: sudo pip3 install coverage | |
- name: Install node dependencies | |
run: yarn install --immutable | |
- name: Build resources | |
run: yarn build | |
- name: Run tests with coverage | |
run: | | |
coverage run --source=. -m unittest discover tests | |
bash <(curl -s https://codecov.io/bash) -cF python | |
inclusive-naming-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check inclusive naming | |
uses: canonical-web-and-design/inclusive-naming@main | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
reporter: github-pr-check | |
fail-on-error: true |