action #823
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: action | |
on: | |
push: | |
branches: [main] | |
schedule: | |
- cron: '0 0 * * *' | |
pull_request: | |
jobs: | |
lint: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: hadolint for controller | |
run: docker run -e "HADOLINT_IGNORE=DL3008" --rm -i hadolint/hadolint < controller/Dockerfile | |
- name: hadolint for compute | |
run: docker run -e "HADOLINT_IGNORE=DL3008" --rm -i hadolint/hadolint < compute/Dockerfile | |
test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Remove unused files | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf "/usr/local/share/boost" | |
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- uses: actions/checkout@v2 | |
- name: Install docker-compose | |
uses: ndeloof/install-compose-action@v0.0.1 | |
with: | |
version: v2.17.3 | |
legacy: true | |
- run: docker-compose --version | |
- name: Build Images | |
run: | | |
docker-compose --file docker-compose.build.yaml up -d | |
sleep 1800 | |
docker-compose --file docker-compose.build.yaml logs -t --tail=100 | |
docker-compose --file docker-compose.build.yaml exec -T --user stack controller /bin/test.bash | |
for c in controller compute-1 compute-2; do | |
docker-compose --file docker-compose.build.yaml exec -T $c /bin/bash -c /bin/pre-commit.bash | |
done | |
docker-compose --file docker-compose.build.yaml stop | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push to Docker Hub | |
if: github.event_name != 'schedule' | |
env: | |
tag: "${{ github.ref == 'refs/heads/main' && 'latest' || github.sha }}" | |
run: | | |
for c in controller compute-1 compute-2; do | |
docker commit $c bobuhiro11/containerized-devstack-$c:$tag | |
docker push bobuhiro11/containerized-devstack-$c:$tag | |
done | |
- name: Test Images | |
if: github.event_name != 'schedule' | |
env: | |
tag: "${{ github.ref == 'refs/heads/main' && 'latest' || github.sha }}" | |
run: | | |
sed -i -e "s/image:.*/&:$tag/g" docker-compose.yaml | |
docker-compose up -d | |
sleep 180 | |
docker-compose exec -T --user stack controller /bin/test.bash |