test #338
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 | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
schedule: | |
- cron: "0 10 * * 5" # JST 19:00 (Fri) | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby: | |
- "2.3" | |
image: | |
- debian:buster | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler-cache: true | |
- run: bundle update --jobs $(nproc) --retry 3 | |
- name: Start container | |
run: | | |
set -xe | |
case "$IMAGE" in | |
"debian:stretch" | "debian:buster" ) | |
docker run --name tmp-debian $IMAGE bash -c "apt-get update && apt-get install -y systemd-sysv" | |
docker commit tmp-debian debian-with-systemd | |
docker run --privileged -d --name container-with-service debian-with-systemd /sbin/init | |
;; | |
esac | |
env: | |
IMAGE: ${{ matrix.image }} | |
- name: Run Itamae | |
run: | | |
set -xe | |
bundle exec itamae docker --node-yaml=recipes/node.yml recipes/install.rb --container=container-with-service --tag itamae-plugin:latest | |
- name: Run Serverspec | |
run: | | |
set -xe | |
bundle exec rspec | |
env: | |
DOCKER_CONTAINER: container-with-service | |
- name: Slack Notification (not success) | |
uses: act10ns/slack@v2 | |
if: "! success()" | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} | |
matrix: ${{ toJson(matrix) }} | |
notify: | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Slack Notification (success) | |
uses: act10ns/slack@v2 | |
if: always() | |
continue-on-error: true | |
with: | |
status: ${{ job.status }} | |
webhook-url: ${{ secrets.SLACK_WEBHOOK }} |