Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 44 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,46 @@ env:


jobs:
build:
name: Build
static-checks:
name: Static Checks
runs-on: ubuntu-latest
steps:
- name: Checkout whatwg/html-build
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache Cargo dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: cargo fmt --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Run tests
run: cargo test
- name: Shellcheck
run: |
shellcheck *.sh
shellcheck ci-build/*.sh

build-and-test-image:
name: Build and Test Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout whatwg/html-build
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Shellcheck
run: |
shellcheck *.sh
shellcheck ci-build/*.sh
- name: Docker build
run: ci-build/docker-build.sh
- name: Checkout whatwg/html
Expand All @@ -38,15 +63,23 @@ jobs:
run: |
mkdir output
bash ci-build/docker-run.sh "$GITHUB_WORKSPACE/html" output

publish:
name: Publish
runs-on: ubuntu-latest
needs: [static-checks, build-and-test-image]
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
permissions:
contents: read
packages: write
steps:
- name: Docker login
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker push
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
docker tag "$REGISTRY/$IMAGE_NAME" "$REGISTRY/$IMAGE_NAME:$GITHUB_SHA"
docker tag "$REGISTRY/$IMAGE_NAME" "$REGISTRY/$IMAGE_NAME:latest"
Expand Down
Loading
Loading