Replace set-output with files to fix actions deprecation (#2) #11
This file contains hidden or 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: Docker Run Action Tests | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| smoke-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run docker action and save version for testing | |
| uses: ./ | |
| id: run-docker | |
| with: | |
| image: docker:29.0.4 | |
| options: -v ${{ github.workspace }}:/work | |
| run: | | |
| echo "$DOCKER_VERSION" > /work/docker_version | |
| - name: Test the output | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const dockerVersion = fs.readFileSync('docker_version', 'utf8').trim(); | |
| const expected = '29.0.4'; | |
| if (dockerVersion !== expected) { | |
| core.setFailed(`Smoke Test Failed: expected ${expected} but received ${dockerVersion}`); | |
| } | |
| volume-mount-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Create File to be mounted | |
| run: echo "some text" > someFile | |
| - name: Run docker action with mounted workspace | |
| uses: ./ | |
| id: run-docker | |
| with: | |
| image: docker | |
| options: -v ${{ github.workspace }}:/work | |
| run: | | |
| cp /work/someFile /work/secondFile | |
| - name: Check if file contents match | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const fileContents = fs.readFileSync('secondFile', 'utf8').trim(); | |
| if (fileContents !== 'some text') { | |
| core.setFailed(`Unable to mount workspace volume`); | |
| } | |
| container-network-test: | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres | |
| env: | |
| POSTGRES_PASSWORD: test | |
| POSTGRES_USER: test | |
| POSTGRES_DB: test | |
| ports: | |
| - 5432:5432 | |
| options: --health-cmd pg_isready --health-interval 5s --health-timeout 5s --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Run docker action and test network connection | |
| uses: ./ | |
| with: | |
| image: postgres | |
| run: > | |
| pg_isready -d test -U test -h postgres -p ${{ job.services.postgres.ports[5432] }} | |
| options: > | |
| -e PGPASSWORD=test |