-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bdc08a7
Showing
8 changed files
with
165 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: CI/CD | ||
|
||
on: | ||
release: | ||
types: | ||
- released | ||
|
||
jobs: | ||
build: | ||
name: build-push | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Lint tag name | ||
run: | | ||
if [[ ! "$GITHUB_REF" =~ ^refs\/tags\/v.+$ ]]; then | ||
echo "Invalid tag name" | ||
exit 1 | ||
fi | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Generate image tag | ||
id: tag | ||
run: | | ||
echo ::set-output name=tag::ghcr.io/z1digitalstudio/storyshots-runner:${GITHUB_REF#refs/tags/v} | ||
- name: Setup QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Setup Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
install: true | ||
|
||
- name: Login to ghcr.io | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GHCR_PUSH_PERSONAL_ACCESS_TOKEN }} | ||
|
||
- uses: docker/build-push-action@v2 | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
with: | ||
builder: ${{ steps.buildx.outputs.name }} | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: ${{ steps.tag.outputs.tag }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM ubuntu:20.04 | ||
|
||
LABEL org.opencontainers.image.source=https://github.com/z1digitalstudio/storyshots-runner | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y curl gnupg2 && \ | ||
# Add Ungoogled Chromium repos | ||
echo 'deb http://download.opensuse.org/repositories/home:/ungoogled_chromium/Ubuntu_Focal/ /' | tee /etc/apt/sources.list.d/home-ungoogled_chromium.list > /dev/null && \ | ||
curl -s 'https://download.opensuse.org/repositories/home:/ungoogled_chromium/Ubuntu_Focal/Release.key' | gpg --dearmor | tee /etc/apt/trusted.gpg.d/home-ungoogled_chromium.gpg > /dev/null && \ | ||
# Add Node.js repos | ||
curl -fsSL https://deb.nodesource.com/setup_14.x | bash - && \ | ||
# Actually install required dependencies | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
firefox \ | ||
nodejs \ | ||
ungoogled-chromium && \ | ||
# Cleanup | ||
apt-get purge -y curl gnupg2 && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
RUN npm install -g yarn |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021-present Z1 DIGITAL STUDIO | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# z1digitalstudio/storyshots-runner | ||
|
||
This repo provides a barebones Docker image based on Ubuntu 20.04 containing: | ||
|
||
* [Ungoogled Chromium][ungoogled-chromium] | ||
* [Mozilla Firefox][firefox] | ||
* [Node.js][node] | ||
* [Yarn v1][yarn] (so yarn v2 can be launched seamlessly) | ||
|
||
This image is meant to execute "storyshot" tests with | ||
[Storybook's `addon-storyshots-puppeteer`][addon-storyshots-puppeteer]. Since | ||
the browsers are already bundled with the Docker image, | ||
[`puppeteer-core`][puppeteer-core] should be used instead of `puppeteer`, which | ||
bundles its own copy of Chromium. | ||
|
||
This setup is necessary to get a consistent result in CI machines and local | ||
machines, otherwise [`jest-image-snapshot`][jest-image-snapshot], the library | ||
used by `@storybook/addon-storyshots-puppeteer` under the hood, can report false | ||
positives due to rendering differences between different builds of the same | ||
browser. | ||
|
||
This repo does not include any examples on how to set up | ||
`@storybook/addon-storyshots-puppeteer`. Please refer to their documentation for | ||
that. | ||
|
||
At [Z1][z1] we're experimenting with the integration of storyshot tests into our | ||
CI/CD workflows. In the future we hope to improve this repo with tools to reduce | ||
the pain of working with storyshots, and a more "out of the box" setup. | ||
|
||
[ungoogled-chromium]: https://github.com/Eloston/ungoogled-chromium | ||
[firefox]: https://www.mozilla.org/en-US/firefox/ | ||
[node]: https://nodejs.org/ | ||
[yarn]: https://yarnpkg.com/ | ||
[addon-storyshots-puppeteer]: https://storybook.js.org/addons/@storybook/addon-storyshots-puppeteer | ||
[puppeteer-core]: https://github.com/puppeteer/puppeteer/#puppeteer-core | ||
[jest-image-snapshot]: https://github.com/americanexpress/jest-image-snapshot | ||
[z1]: https://z1.digital/ |