Skillforge part 2 #769
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: Test and Lint | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
push: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Load image url | |
id: load_image_url | |
run: | | |
IMAGE_URL=`make image-url` | |
echo "image-url=$IMAGE_URL" >> "$GITHUB_OUTPUT" | |
- name: Restore Cache | |
uses: actions/cache@v3 | |
id: restore_cache | |
with: | |
path: image.tar | |
key: ${{ steps.load_image_url.outputs.image-url }} | |
- name: Build Docker image | |
id: build | |
if: steps.restore_cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p .sentinel | |
IMAGE_URL=`make image-url` | |
echo "Building Docker image: $IMAGE_URL" | |
make image | |
docker save $IMAGE_URL > image.tar | |
- name: Cache docker image | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: image.tar | |
key: ${{ steps.load_image_url.outputs.image-url }} | |
nodejs_build: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Load image url | |
id: load_image_url | |
run: | | |
IMAGE_URL=`make image-url-nodejs` | |
echo "image-url-nodejs=$IMAGE_URL" >> "$GITHUB_OUTPUT" | |
- name: Restore Cache | |
uses: actions/cache@v3 | |
id: restore_cache_nodejs | |
with: | |
path: image-nodejs.tar | |
key: ${{ steps.load_image_url.outputs.image-url-nodejs }} | |
- name: Build Docker image | |
id: build | |
if: steps.restore_cache_nodejs.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p .sentinel | |
IMAGE_URL=`make image-url-nodejs` | |
echo "Building NodeJS Docker image: $IMAGE_URL" | |
make nodejs | |
docker save $IMAGE_URL > image-nodejs.tar | |
- name: Cache docker image | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: image-nodejs.tar | |
key: ${{ steps.load_image_url.outputs.image-url-nodejs }} | |
dev_setup: | |
needs: [nodejs_build, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Load image url | |
id: load_image_url | |
shell: bash | |
run: | | |
IMAGE_URL_NODEJS=`make image-url-nodejs` | |
echo "image-url-nodejs=$IMAGE_URL_NODEJS" >> "$GITHUB_OUTPUT" | |
- name: setup | |
shell: bash | |
run: | | |
echo "Loading cached image: ${{ steps.load_image_url.outputs.image-url-nodejs }}" | |
- name: Restore Nodejs Image Cache | |
uses: actions/cache@v3 | |
id: restore_cache_nodejs | |
with: | |
path: image-nodejs.tar | |
key: ${{ steps.load_image_url.outputs.image-url-nodejs }} | |
- name: load nodejs image | |
shell: bash | |
run: | | |
docker load --input image-nodejs.tar | |
docker tag ${{ steps.load_image_url.outputs.image-url-nodejs }} ghcr.io/kreneskyp/ix/nodejs:latest | |
- name: Test dev_setup | |
uses: ./.github/actions/run-docker | |
with: | |
command: make dev_setup | |
pytest: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run pytest | |
uses: ./.github/actions/run-docker | |
with: | |
command: make pytest | |
black: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run black | |
uses: ./.github/actions/run-docker | |
with: | |
command: make black-check | |
flake8: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run flake8 | |
uses: ./.github/actions/run-docker | |
with: | |
command: make flake8 | |
prettier: | |
needs: nodejs_build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Load image url | |
id: load_image_url | |
shell: bash | |
run: | | |
IMAGE_URL_NODEJS=`make image-url-nodejs` | |
echo "image-url-nodejs=$IMAGE_URL_NODEJS" >> "$GITHUB_OUTPUT" | |
- name: setup | |
shell: bash | |
run: | | |
echo "Loading cached image: ${{ steps.load_image_url.outputs.image-url-nodejs }}" | |
- name: Restore Nodejs Image Cache | |
uses: actions/cache@v3 | |
id: restore_cache_nodejs | |
with: | |
path: image-nodejs.tar | |
key: ${{ steps.load_image_url.outputs.image-url-nodejs }} | |
- name: load nodejs image | |
shell: bash | |
run: | | |
docker load --input image-nodejs.tar | |
docker tag ${{ steps.load_image_url.outputs.image-url-nodejs }} ghcr.io/kreneskyp/ix/nodejs:latest | |
- name: Run Prettier | |
uses: ./.github/actions/run-docker | |
with: | |
command: make prettier-check | |
# Disabling until a later date | |
# | |
# pyright: | |
# needs: build | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: Run Pyright | |
# uses: ./.github/actions/run-docker | |
# with: | |
# command: make pyright |