Add gh action for CodeQL schedule #8171
Workflow file for this run
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: 'E2E tests' | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- master | |
- 'V*' | |
jobs: | |
e2e-test: | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
# use go version from go.mod. | |
go-version-file: 'go.mod' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setting git SHA to PR head | |
if: ${{ github.event_name == 'pull_request' }} | |
run: echo "SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV | |
- name: Setting git SHA to branch head | |
if: ${{ github.event_name != 'pull_request' }} | |
run: echo "SHA=${{ github.sha }}" >> $GITHUB_ENV | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
if: ${{ github.actor != 'dependabot' }} | |
with: | |
context: . | |
file: Dockerfile | |
platforms: linux/amd64 | |
push: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }} | |
tags: ghcr.io/nuts-foundation/nuts-node-ci:${{ env.SHA }} | |
secrets: | | |
GIT_AUTH_TOKEN=${{ secrets.PACKAGE_SECRET }} | |
- name: Build and push dependabot | |
uses: docker/build-push-action@v6 | |
if: ${{ github.actor == 'dependabot' }} | |
with: | |
context: . | |
file: Dockerfile | |
platforms: linux/amd64 | |
push: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }} | |
tags: ghcr.io/nuts-foundation/nuts-node-ci:${{ env.SHA }} | |
- name: Run E2E tests | |
run: | | |
cd e2e-tests && \ | |
find . -type f -name "docker-compose*.yml" | xargs -I{} sed -i 's~nutsfoundation/nuts-node:master~ghcr.io/nuts-foundation/nuts-node-ci:${{ env.SHA }}~g' {} && \ | |
find . -type f -name "run-test.sh" | xargs -I{} sed -i 's/docker-compose exec/docker-compose exec -T/g' {} && \ | |
./run-tests.sh | |
- name: package cleanup | |
uses: dataaxiom/ghcr-cleanup-action@v1 | |
if: ${{ github.actor != 'dependabot' }} | |
with: | |
owner: nuts-foundation | |
package: nuts-node-ci | |
# NOTE: using Personal Access Token | |
token: ${{ secrets.PACKAGE_SECRET }} | |
keep-n-tagged: 3 | |
- name: package cleanup dependabot | |
uses: dataaxiom/ghcr-cleanup-action@v1 | |
if: ${{ github.actor == 'dependabot' }} | |
with: | |
owner: nuts-foundation | |
package: nuts-node-ci | |
# NOTE: using Personal Access Token | |
token: ${{ secrets.GITHUB_TOKEN }} | |
keep-n-tagged: 3 |