diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9a859f64..226d9807c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,13 +3,13 @@ name: build_docker_image on: push: - branches: [dev] + branches: [dev, test-github-actions] paths: - 'Dockerfile' - 'requirements.txt' - '.github/workflows/build.yml' pull_request: - branches: [dev] + branches: [dev, test-github-actions] paths: - 'Dockerfile' - 'requirements.txt' @@ -18,18 +18,24 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: write-all steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Login to GitHub Packages - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: docker.pkg.github.com username: ${{ github.actor }} - password: ${{ secrets.GH_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: set lower case owner name + run: | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' - name: Build and push Docker image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . push: true - tags: docker.pkg.github.com/seshat-global-history-databank/seshat/tests-image:latest \ No newline at end of file + tags: docker.pkg.github.com/${{ env.OWNER_LC }}/seshat/tests-image:latest \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b74fabf63..157edef65 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,25 +3,30 @@ name: test_code on: push: - branches: [dev] + branches: [dev, test-github-actions] pull_request: - branches: [dev] + branches: [dev, test-github-actions] jobs: test_core: runs-on: ['ubuntu-latest'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Login to GitHub Packages - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: docker.pkg.github.com username: ${{ github.actor }} - password: ${{ secrets.GH_TOKEN }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: set lower case owner name + run: | + echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} + env: + OWNER: '${{ github.repository_owner }}' - name: Pull and run Docker image run: | - docker pull docker.pkg.github.com/seshat-global-history-databank/seshat/tests-image:latest - docker run -d -p 5432:5432 -v ${{ github.workspace }}:/seshat -e DJANGO_SETTINGS_MODULE=seshat.settings.local -e POSTGRES_PASSWORD=postgres -e PGDATA=/var/lib/postgresql/data/db-files/ -e GITHUB_ACTIONS='true' --name seshat_testing docker.pkg.github.com/seshat-global-history-databank/seshat/tests-image:latest + docker pull docker.pkg.github.com/${{ env.OWNER_LC }}/seshat/tests-image:latest + docker run -d -p 5432:5432 -v ${{ github.workspace }}:/seshat -e DJANGO_SETTINGS_MODULE=seshat.settings.local -e POSTGRES_PASSWORD=postgres -e PGDATA=/var/lib/postgresql/data/db-files/ -e GITHUB_ACTIONS='true' --name seshat_testing docker.pkg.github.com/${{ env.OWNER_LC }}/seshat/tests-image:latest - name: Sleep, then check PostgreSQL connectivity run: | sleep 10