Skip to content

Commit

Permalink
Testing devcontainers/ci
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbosch committed Oct 25, 2024
1 parent c0ae6ec commit 376d588
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
10 changes: 6 additions & 4 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ ARG VARIANT=hugo
# VERSION can be either 'latest' or a specific version number
ARG VERSION=latest

# Download Hugo
# Download Hugo Dependencies
RUN apt-get update && apt-get install -y ca-certificates openssl git curl golang python-is-python3 && \
rm -rf /var/lib/apt/lists/* && \
case ${VERSION} in \
rm -rf /var/lib/apt/lists/*

# Download Hugo
RUN case ${VERSION} in \
latest) \
export VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4)}') ;;\
esac && \
Expand All @@ -35,7 +37,7 @@ RUN apt-get update && apt-get install -y ca-certificates openssl git curl golang
*) \
export ARCH=64bit ;; \
esac && \
echo Wanted Architecture is ${ARCH} && \
echo Hugo architecture identifier is ${ARCH} && \
wget -O ${VERSION}.tar.gz https://github.com/gohugoio/hugo/releases/download/v${VERSION}/${VARIANT}_${VERSION}_Linux-${ARCH}.tar.gz && \
tar xf ${VERSION}.tar.gz && \
mv hugo /usr/bin/hugo
Expand Down
4 changes: 3 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@
"remoteUser": "node",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": ".devcontainer/scripts/postCreateCommand.sh",
"postStartCommand": "hugo server -b http://localhost/velocitas -w"
// Hugo needs to run in the background as otherwise postStartCommand will never finish
//
"postStartCommand": "nohup bash -c 'hugo server -b http://localhost/velocitas -w &'"
}
19 changes: 12 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ name: CI workflow
on:
workflow_dispatch:
push:
branches:
- "main"
pull_request:

jobs:
Expand All @@ -33,10 +35,14 @@ jobs:
hugo-version: "0.123.3"
extended: true

- name: Verify that devcontainer works
run: |
cd .devcontainer
docker buildx build -f Dockerfile -t test:latest .
- name: Build devcontainer and run automated tests
uses: devcontainers/[email protected]
with:
runCmd: |
# Give some time for server to come up
sleep 20
# Do a sanity check that the server has started and says something about eclipse
curl http://localhost:1313/velocitas/docs/about/ | grep -e eclipse
- name: Build
run: |
Expand All @@ -57,11 +63,10 @@ jobs:
echo -e "\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Publish to GH Pages
# Note that gh_pages isnt published to https://eclipse-velocitas.github.io/velocitas-docs/
# Note that gh_pages isn't published to https://eclipse-velocitas.github.io/velocitas-docs/
# or the alias https://eclipse.dev/velocitas/
# So this basically just check if there are errors :-)
# Only publish to gh_pages if this was a push to master
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
if: ${{ github.event_name == 'push'}}
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down

0 comments on commit 376d588

Please sign in to comment.